// Copyright (c) 2021 Contributors to the Eclipse Foundation
// 
// See the NOTICE file(s) distributed with this work for additional
// information regarding copyright ownership.
// 
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0
// 
// SPDX-License-Identifier: EPL-2.0
//
var FVT = {};

var assert = require('assert');
var request = require('supertest');
var should = require('should');
var fs = require('fs');
var mqtt = require('mqtt');
var qs = require('querystring');

// Helper Functions
/* 
 *  Debug Trace print statements.
 */
FVT.trace = function(level, message ) {
    if ( level <= FVT.DEBUG ) {
        console.log( indent + message );
    }
};

/* **********************************
** Delay for a number of milliseconds
*/
FVT.REBOOT = process.env.REBOOT
if (FVT.REBOOT === undefined)
    FVT.REBOOT = 32000;
//FVT.REBOOT = 320;
FVT.RESETCONFIG = FVT.REBOOT + 4000;
FVT.CLEANSTORE  = FVT.REBOOT + 5000;
FVT.MAINTENANCE = FVT.REBOOT + 7000;
FVT.START_HA    = FVT.REBOOT + 25000;
FVT.START_CLUSTER = FVT.REBOOT + 30000;
FVT.START_MQ = 10000 ;   // In automation, it can take 6 seconds or more
FVT.START_SNMP = 3000 ;
FVT.DELETE_CLIENTSET = 5000 ;
FVT.DELETE_LARGE_CLIENTSET = 15000 ;
// USE THESE for this.timeout() along the the appropriate FVT.Sleep() value above
FVT.defaultTimeout = 5000;  //  was 2000 until 10/02/2015 
FVT.mqTimeout = 58000;    //136980 and other having long timeouts waiting on MQ responses
FVT.crlTimeout = 55000 ; // when validating URL CRLSource
FVT.clientSetTimeout = process.env.ClientSetTimeout
if (FVT.clientSetTimeout === undefined)
    FVT.clientSetTimeout = 40000 ; // (20000) when issuing ClientSet Monitor Queries (2 min update interval?), Import&Export are relatively fast
// UGH! defect 217232 can not access res.req.... Both Bridge and MS contain CONNECTION Objects and they are dis-similar -- causes problem in verify of FVT.getSuccessCallback
//    if ( res.req.url.search( "/ima/" ) >= 0 ) { FVT.MS_RESTAPI_TYPE = true ; }   DOES NOT WORK, have to DECLARE in BRIDGE TC's by setting to false.
FVT.MS_RESTAPI_TYPE=true;
	
/* TEMP - can remove this log later */
console.log( " ====  DEBUG DEFECT 212728 -- FVT.REBOOT:"+ FVT.REBOOT +"ms,  FVT.clientSetTimeout:"+ FVT.clientSetTimeout +"ms.");    
    
	
FVT.sleep = function (delay) {
    var start = new Date().getTime();
    FVT.trace( 1, "Sleeping for "+ delay +"ms");
    while (new Date().getTime() < start + delay);
}



/* 
 *  SSH a Command to the Server and execute 
 *  Pass by Reference is difficult in JavaScript, that is what 'target' WAS for   eval(target)=data, but that fails.
 * Workaround:  after calling FVT.sshCmd, 
 *  Stay in a while loop until FVT.sshResonse.results <> TBD, then pull the value from FVT.sshResponse.result and assign  NOPE, not in use yet...
 */
FVT.A1_USER    = process.env.A1_USER;
FVT.A1_PW      = process.env.A1_PW;
FVT.A1_HOST    = process.env.A1_HOST;
FVT.A_COUNT    = process.env.A_COUNT;
FVT.TestEnv    = process.env.TestEnv;
FVT.A1_HOST_OS = process.env.A1_HOST_OS;    // EC2* does not handle IPv6 

FVT.version = 'v1' ;

//var MOCHA_STOP_FIRST_ERROR = ( process.env.MOCHA_STOP_FIRST_ERROR === 'undefined'  ? MOCHA_STOP_FIRST_ERROR : false );  
// NOT IMPLEMENTED, don't control 'should' checks - processing would not stop -- try later
var MOCHA_STOP_FIRST_ERROR = (  process.env.MOCHA_STOP_FIRST_ERROR == 'true' ) ? true : false ;
console.log(  ' === MOCHA_STOP_FIRST_ERROR: '+ MOCHA_STOP_FIRST_ERROR );

FVT.lastPost = {} ;
FVT.lastPost['stats'] = { "status":200, "PortFrom":9089, "PortTo":9089 } ;
console.log( "AdminEndpoint PORT is now: " + FVT.lastPost['stats'][ "PortFrom" ] );

FVT.IMA_AdminEndpoint = process.env.IMA_AdminEndpoint;
if ( FVT.IMA_AdminEndpoint === undefined ) {
    FVT.IMA_AdminEndpoint = process.env.A1_HOST + ':' + process.env.A1_PORT ;
    if ( FVT.IMA_AdminEndpoint === undefined ) {
        console.log( ' === ABORT!  Set and Export IMA_AdminEndpoint=A1_HOST:A1_PORT in the env -OR- source ISMsetup.sh - Exiting now.' );
        exit;
    }
}
var url = 'http://' + FVT.IMA_AdminEndpoint;
var A2_url = "";
// FVT.A1_REST_USER = ( process.env.A1_REST_USER != undefined ) process.env.A1_REST_USER ? 'admin' ;
// FVT.A1_REST_PW   = ( process.env.A1_REST_PW != undefined   ) process.env.A1_REST_PW   ? 'admin' ;
FVT.A1_REST_USER = process.env.A1_REST_USER;
FVT.A1_REST_PW   = process.env.A1_REST_PW;
FVT.SyslogServer = process.env.SYSLOGServer;
FVT.SyslogPort_tcp   = process.env.SYSLOGPort_tcp;
FVT.SyslogPort_udp   = process.env.SYSLOGPort_udp;
FVT.IMA_AUTOMATION   = process.env.IMA_AUTOMATION;   // used to tell if IMA Automation Env or personal automation ( for LicensedUsage test case, Frank changes the initial License type to Production)

console.log(  ' === IMA_AdminEndpoint: '+ url + '  with UID: '+ FVT.A1_REST_USER + ' and PW: '+ FVT.A1_REST_PW  );

FVT.msgServer           = process.env.A1_IPv4_1 ;
FVT.A1_IPv4_INTERNAL_1  = process.env.A1_IPv4_INTERNAL_1 ;
FVT.A1_PORT             = process.env.A1_PORT ;
FVT.msgServer_IPv6      = process.env.A1_IPv6_1;
FVT.A1_IPv6_INTERNAL_1  = process.env.A1_IPv6_INTERNAL_1;
FVT.A1_INTFNAME_1       = process.env.A1_INTFNAME_1;
FVT.A1_msgServer_2      = process.env.A1_IPv4_2 ;
FVT.A1_IPv4_INTERNAL_2  = process.env.A1_IPv4_INTERNAL_2 ;
FVT.A1_IPv6_2           = process.env.A1_IPv6_2;
FVT.A1_IPv6_INTERNAL_2  = process.env.A1_IPv6_INTERNAL_2;
FVT.A1_INTFNAME_2       = process.env.A1_INTFNAME_2;
FVT.A1_IPv4_HA0         = process.env.A1_IPv4_HA0;
FVT.A1_IPv6_HA0         = process.env.A1_IPv6_HA0;
FVT.A1_IPv4_HA1         = process.env.A1_IPv4_HA1;
FVT.A1_IPv6_HA1         = process.env.A1_IPv6_HA1;
FVT.A1_HOSTNAME         = process.env.A1_IPv4_HOSTNAME_1;
FVT.A1_HOSTNAME_OS      = process.env.A1_HOSTNAME_OS;           // Set in getA_Hostnames.sh file( passed in run-scenario seed file), ISMSetup.sh testEnv.sh does not have a reliable parameter in all envs.
FVT.A1_HOSTNAME_OS_SHORT = process.env.A1_HOSTNAME_OS_SHORT;    // Set in getA_Hostnames.sh file( passed in run-scenario seed file), ISMSetup.sh testEnv.sh does not have a reliable parameter in all envs.
FVT.A1_SERVERNAME       = process.env.A1_SERVERNAME;            // Set in getA_Hostnames.sh file( passed in run-scenario seed file), ISMSetup.sh testEnv.sh does not have a reliable parameter in all envs.
FVT.A1_USER             = process.env.A1_USER;
FVT.A1_PW               = process.env.A1_PW;
FVT.A1_HOST             = process.env.A1_HOST;
FVT.A1_TYPE             = process.env.A1_TYPE;

FVT.P1_USER             = process.env.P1_USER;
FVT.P1_HOST             = process.env.P1_HOST;
FVT.P1_IPv4_1           = process.env.P1_IPv4_1;
FVT.P1_BRIDGEPORT       = process.env.P1_BRIDGEPORT;
FVT.P1_REST_USER        = process.env.P1_REST_USER;
FVT.P1_REST_PW          = process.env.P1_REST_PW;

if ( FVT.msgServer === undefined ) {
    var index = url.lastIndexOf(':');
    FVT.msgServer = url.substring(7, index);
}

console.log( ' === A1 MQTTServer IPv4 is (FVT.msgServer):  '+ FVT.msgServer + ' and FVT.msgServer_IPv6 is: '+ FVT.msgServer_IPv6 );
console.log( ' === A1 HA0 IPv4: '+ FVT.A1_IPv4_HA0 +' IPv6: '+ FVT.A1_IPv6_HA0 +'  --  HA2  IPv4: '+ FVT.A1_IPv4_HA1 +' IPv6: '+ FVT.A1_IPv6_HA1 );
console.log( ' === A1_SERVERNAME(stem) is '+ FVT.A1_SERVERNAME  );

FVT.A_COUNT = process.env.A_COUNT;
if ( FVT.A_COUNT >= "2" ) {
    FVT.A2_IMA_AdminEndpoint = process.env.A2_IMA_AdminEndpoint ;
    if ( FVT.A2_IMA_AdminEndpoint === undefined ) {
        FVT.A2_IMA_AdminEndpoint = process.env.A2_HOST + ':' + process.env.A2_PORT ;
        if ( FVT.A2_IMA_AdminEndpoint === undefined ) {
            console.log( ' === ABORT!  Set and Export A2_IMA_AdminEndpoint=A2_HOST:A2_PORT in the env -OR- source ISMsetup.sh - Exiting now.' );
            exit;
        }
    }
    A2_url                  =  'http://' + FVT.A2_IMA_AdminEndpoint;
    // FVT.A2_REST_USER      = ( process.env.A2_REST_USER ) process.env.A2_REST_USER ? 'admin' ;
    // FVT.A2_REST_PW        = ( process.env.A2_REST_PW )   process.env.A2_REST_PW   ? 'admin' ;
    FVT.A2_REST_USER        = process.env.A2_REST_USER;
    FVT.A2_REST_PW          = process.env.A2_REST_PW;
    FVT.A2_msgServer        = process.env.A2_IPv4_1;
    FVT.A2_IPv4_INTERNAL_1  = process.env.A2_IPv4_INTERNAL_1;
    FVT.A2_PORT             = process.env.A2_PORT ;
    FVT.A2_msgServer_IPv6   = process.env.A2_IPv6_1;
    FVT.A2_IPv6_INTERNAL_1  = process.env.A2_IPv6_INTERNAL_1;
    FVT.A2_INTFNAME_1       = process.env.A2_INTFNAME_1;
    FVT.A2_msgServer_2      = process.env.A2_IPv4_2;
    FVT.A2_IPv4_INTERNAL_2  = process.env.A2_IPv4_INTERNAL_2;
    FVT.A2_msgServer_IPv6_2 = process.env.A2_IPv6_2;
    FVT.A2_IPv6_INTERNAL_2  = process.env.A2_IPv6_INTERNAL_2;
    FVT.A2_INTFNAME_2       = process.env.A2_INTFNAME_2;
    FVT.A2_IPv4_HA0         = process.env.A2_IPv4_HA0;
    FVT.A2_IPv6_HA0         = process.env.A2_IPv6_HA0;
    FVT.A2_IPv4_HA1         = process.env.A2_IPv4_HA1;
    FVT.A2_IPv6_HA1         = process.env.A2_IPv6_HA1;
    FVT.A2_HOSTNAME         = process.env.A2_IPv4_HOSTNAME_1;
    FVT.A2_HOSTNAME_OS       = process.env.A2_HOSTNAME_OS;          // Set in getA_Hostnames.sh file( passed in run-scenario seed file), ISMSetup.sh testEnv.sh does not have a reliable parameter in all envs.
    FVT.A2_HOSTNAME_OS_SHORT = process.env.A2_HOSTNAME_OS_SHORT;    // Set in getA_Hostnames.sh file( passed in run-scenario seed file), ISMSetup.sh testEnv.sh does not have a reliable parameter in all envs.
    FVT.A2_SERVERNAME       = process.env.A2_SERVERNAME;            // Set in getA_Hostnames.sh file( passed in run-scenario seed file), ISMSetup.sh testEnv.sh does not have a reliable parameter in all envs.
    FVT.A2_USER             = process.env.A2_USER;
    FVT.A2_PW               = process.env.A2_PW;
    FVT.A2_HOST             = process.env.A2_HOST;
    FVT.A2_TYPE             = process.env.A2_TYPE;
    // Env vars: A#_INTFNAME_# are set in ism-RESTAPI-01 and 02.sh

    FVT.P2_USER             = process.env.P2_USER;
    FVT.P2_HOST             = process.env.P2_HOST;
    FVT.P2_IPv4_1           = process.env.P2_IPv4_1;
    FVT.P2_BRIDGEPORT       = process.env.P2_BRIDGEPORT;
    FVT.P2_REST_USER        = process.env.P2_REST_USER;
    FVT.P2_REST_PW          = process.env.P2_REST_PW;


    console.log( ' ==== A2_IMA_AdminEndpoint: '+ A2_url + '  with UID: '+ FVT.A2_REST_USER + ' and PW: '+ FVT.A2_REST_PW );
    console.log( ' ==== A2 MQTTServer IPv4 is (FVT.A2_msgServer):  '+ FVT.A2_msgServer + ' and FVT.A2_msgServer_IPv6 is: '+ FVT.A2_msgServer_IPv6 );
    console.log( ' ==== A2 HA0 IPv4: '+ FVT.A2_IPv4_HA0 +' IPv6: '+ FVT.A2_IPv6_HA0 +'  --  HA1  IPv4: '+ FVT.A2_IPv4_HA1 +' IPv6: '+ FVT.A2_IPv6_HA1 );
    console.log( ' ==== A2_SERVERNAME(stem) is '+ FVT.A2_SERVERNAME  );
} else {
   console.log( ' === IF HA IPs are needed, missing Server2 definitions - not sourced in ENV' );
}
if ( FVT.A_COUNT >= "3" ) {
    FVT.A3_IMA_AdminEndpoint = process.env.A3_IMA_AdminEndpoint ;
    if ( FVT.A3_IMA_AdminEndpoint === undefined ) {
        FVT.A3_IMA_AdminEndpoint = process.env.A3_HOST + ':' + process.env.A3_PORT ;
        if ( FVT.A3_IMA_AdminEndpoint === undefined ) {
            console.log( ' === ABORT!  Set and Export A3_IMA_AdminEndpoint=A3_HOST:A3_PORT in the env -OR- source ISMsetup.sh - Exiting now.' );
            exit;
        }
    }
    A3_url                  =  'http://' + FVT.A3_IMA_AdminEndpoint;
    // FVT.A3_REST_USER      = ( process.env.A3_REST_USER ) process.env.A3_REST_USER ? 'admin' ;
    // FVT.A3_REST_PW        = ( process.env.A3_REST_PW )   process.env.A3_REST_PW   ? 'admin' ;
    FVT.A3_REST_USER        = process.env.A3_REST_USER;
    FVT.A3_REST_PW          = process.env.A3_REST_PW;
    FVT.A3_msgServer        = process.env.A3_IPv4_1;
    FVT.A3_IPv4_INTERNAL_1  = process.env.A3_IPv4_INTERNAL_1;
    FVT.A3_PORT             = process.env.A3_PORT ;
    FVT.A3_msgServer_IPv6   = process.env.A3_IPv6_1;
    FVT.A3_IPv6_INTERNAL_1  = process.env.A3_IPv6_INTERNAL_1;
    FVT.A3_INTFNAME_1       = process.env.A3_INTFNAME_1;
    FVT.A3_msgServer_2      = process.env.A3_IPv4_2;
    FVT.A3_IPv4_INTERNAL_2  = process.env.A3_IPv4_INTERNAL_2;
    FVT.A3_msgServer_IPv6_2 = process.env.A3_IPv6_2;
    FVT.A3_IPv6_INTERNAL_2  = process.env.A3_IPv6_INTERNAL_2;
    FVT.A3_INTFNAME_2       = process.env.A3_INTFNAME_2;
    FVT.A3_IPv4_HA0         = process.env.A3_IPv4_HA0;
    FVT.A3_IPv6_HA0         = process.env.A3_IPv6_HA0;
    FVT.A3_IPv4_HA1         = process.env.A3_IPv4_HA1;
    FVT.A3_IPv6_HA1         = process.env.A3_IPv6_HA1;
    FVT.A3_HOSTNAME         = process.env.A3_IPv4_HOSTNAME_1;
    FVT.A3_HOSTNAME_OS       = process.env.A3_HOSTNAME_OS;          // Set in getA_Hostnames.sh file( passed in run-scenario seed file), ISMSetup.sh testEnv.sh does not have a reliable parameter in all envs.
    FVT.A3_HOSTNAME_OS_SHORT = process.env.A3_HOSTNAME_OS_SHORT;    // Set in getA_Hostnames.sh file( passed in run-scenario seed file), ISMSetup.sh testEnv.sh does not have a reliable parameter in all envs.
    FVT.A3_SERVERNAME       = process.env.A3_SERVERNAME;            // Set in getA_Hostnames.sh file( passed in run-scenario seed file), ISMSetup.sh testEnv.sh does not have a reliable parameter in all envs.
    FVT.A3_USER             = process.env.A3_USER;
    FVT.A3_PW               = process.env.A3_PW;
    FVT.A3_HOST             = process.env.A3_HOST;
    FVT.A3_TYPE             = process.env.A3_TYPE;
    // Env vars: A#_INTFNAME_# are set in ism-RESTAPI-01 and 02.sh

    FVT.P3_USER             = process.env.P3_USER;
    FVT.P3_HOST             = process.env.P3_HOST;
    FVT.P3_IPv4_1           = process.env.P3_IPv4_1;
    FVT.P3_BRIDGEPORT       = process.env.P3_BRIDGEPORT;
    FVT.P3_REST_USER        = process.env.P3_REST_USER;
    FVT.P3_REST_PW          = process.env.P3_REST_PW;


    console.log( ' ==== A3_IMA_AdminEndpoint: '+ A3_url + '  with UID: '+ FVT.A3_REST_USER + ' and PW: '+ FVT.A3_REST_PW );
    console.log( ' ==== A3 MQTTServer IPv4 is (FVT.A3_msgServer):  '+ FVT.A3_msgServer + ' and FVT.A3_msgServer_IPv6 is: '+ FVT.A3_msgServer_IPv6 );
    console.log( ' ==== A3 HA0 IPv4: '+ FVT.A3_IPv4_HA0 +' IPv6: '+ FVT.A3_IPv6_HA0 +'  --  HA1  IPv4: '+ FVT.A3_IPv4_HA1 +' IPv6: '+ FVT.A3_IPv6_HA1 );
    console.log( ' ==== A3_SERVERNAME(stem) is '+ FVT.A3_SERVERNAME  );
} else {
   console.log( ' === IF HA IPs are needed, missing Server3 definitions - not sourced in ENV' );
}
if ( FVT.A_COUNT >= "4" ) {
    FVT.A4_IMA_AdminEndpoint = process.env.A4_IMA_AdminEndpoint ;
    if ( FVT.A4_IMA_AdminEndpoint === undefined ) {
        FVT.A4_IMA_AdminEndpoint = process.env.A4_HOST + ':' + process.env.A4_PORT ;
        if ( FVT.A4_IMA_AdminEndpoint === undefined ) {
            console.log( ' === ABORT!  Set and Export A4_IMA_AdminEndpoint=A4_HOST:A4_PORT in the env -OR- source ISMsetup.sh - Exiting now.' );
            exit;
        }
    }
    A4_url                  =  'http://' + FVT.A4_IMA_AdminEndpoint;
    // FVT.A4_REST_USER      = ( process.env.A4_REST_USER ) process.env.A4_REST_USER ? 'admin' ;
    // FVT.A4_REST_PW        = ( process.env.A4_REST_PW )   process.env.A4_REST_PW   ? 'admin' ;
    FVT.A4_REST_USER        = process.env.A4_REST_USER;
    FVT.A4_REST_PW          = process.env.A4_REST_PW;
    FVT.A4_msgServer        = process.env.A4_IPv4_1;
    FVT.A4_IPv4_INTERNAL_1  = process.env.A4_IPv4_INTERNAL_1;
    FVT.A4_PORT             = process.env.A4_PORT ;
    FVT.A4_msgServer_IPv6   = process.env.A4_IPv6_1;
    FVT.A4_IPv6_INTERNAL_1  = process.env.A4_IPv6_INTERNAL_1;
    FVT.A4_INTFNAME_1       = process.env.A4_INTFNAME_1;
    FVT.A4_msgServer_2      = process.env.A4_IPv4_2;
    FVT.A4_IPv4_INTERNAL_2  = process.env.A4_IPv4_INTERNAL_2;
    FVT.A4_msgServer_IPv6_2 = process.env.A4_IPv6_2;
    FVT.A4_IPv6_INTERNAL_2  = process.env.A4_IPv6_INTERNAL_2;
    FVT.A4_INTFNAME_2       = process.env.A4_INTFNAME_2;
    FVT.A4_IPv4_HA0         = process.env.A4_IPv4_HA0;
    FVT.A4_IPv6_HA0         = process.env.A4_IPv6_HA0;
    FVT.A4_IPv4_HA1         = process.env.A4_IPv4_HA1;
    FVT.A4_IPv6_HA1         = process.env.A4_IPv6_HA1;
    FVT.A4_HOSTNAME         = process.env.A4_IPv4_HOSTNAME_1;
    FVT.A4_HOSTNAME_OS       = process.env.A4_HOSTNAME_OS;          // Set in getA_Hostnames.sh file( passed in run-scenario seed file), ISMSetup.sh testEnv.sh does not have a reliable parameter in all envs.
    FVT.A4_HOSTNAME_OS_SHORT = process.env.A4_HOSTNAME_OS_SHORT;    // Set in getA_Hostnames.sh file( passed in run-scenario seed file), ISMSetup.sh testEnv.sh does not have a reliable parameter in all envs.
    FVT.A4_SERVERNAME       = process.env.A4_SERVERNAME;            // Set in getA_Hostnames.sh file( passed in run-scenario seed file), ISMSetup.sh testEnv.sh does not have a reliable parameter in all envs.
    FVT.A4_USER             = process.env.A4_USER;
    FVT.A4_PW               = process.env.A4_PW;
    FVT.A4_HOST             = process.env.A4_HOST;
    FVT.A4_TYPE             = process.env.A4_TYPE;
    // Env vars: A#_INTFNAME_# are set in ism-RESTAPI-01 and 02.sh

    FVT.P4_USER             = process.env.P4_USER;
    FVT.P4_HOST             = process.env.P4_HOST;
    FVT.P4_IPv4_1           = process.env.P4_IPv4_1;
    FVT.P4_BRIDGEPORT       = process.env.P4_BRIDGEPORT;
    FVT.P4_REST_USER        = process.env.P4_REST_USER;
    FVT.P4_REST_PW          = process.env.P4_REST_PW;


    console.log( ' ==== A4_IMA_AdminEndpoint: '+ A4_url + '  with UID: '+ FVT.A4_REST_USER + ' and PW: '+ FVT.A4_REST_PW );
    console.log( ' ==== A4 MQTTServer IPv4 is (FVT.A4_msgServer):  '+ FVT.A4_msgServer + ' and FVT.A4_msgServer_IPv6 is: '+ FVT.A4_msgServer_IPv6 );
    console.log( ' ==== A4 HA0 IPv4: '+ FVT.A4_IPv4_HA0 +' IPv6: '+ FVT.A4_IPv6_HA0 +'  --  HA1  IPv4: '+ FVT.A4_IPv4_HA1 +' IPv6: '+ FVT.A4_IPv6_HA1 );
    console.log( ' ==== A4_SERVERNAME(stem) is '+ FVT.A4_SERVERNAME  );
} else {
   console.log( ' === IF HA IPs are needed, missing Server4 definitions - not sourced in ENV' );
}
//M1 Variables
FVT.M1_IMA_SDK   = process.env.M1_IMA_SDK ; 
FVT.M1_IPv4_1    = process.env.M1_IPv4_1;
FVT.M1_IPv6_1    = process.env.M1_IPv6_1;
FVT.M1_HOST      = process.env.M1_HOST;
FVT.M1_TESTROOT  = process.env.M1_TESTROOT;
FVT.M1_URL       = process.env.M1_URL;

//M2 Variables
FVT.M2_IMA_SDK   = process.env.M2_IMA_SDK ; 
FVT.M2_IPv4_1    = process.env.M2_IPv4_1;
FVT.M2_IPv6_1    = process.env.M2_IPv6_1;
FVT.M2_HOST      = process.env.M2_HOST;

FVT.LTPAWAS_IP     =  process.env.LTPAWAS_IP ;
FVT.WASIP          =  process.env.WASIP ;
FVT.WASTYPE        =  process.env.WASTYPE ;
FVT.WASCLUSTERIP   =  process.env.WASClusterIP ;
FVT.WASPATH        =  process.env.WASPATH ;

FVT.MQSERVER1_IP   =  process.env.MQSERVER1_IP ;
FVT.MQSERVER1_IPv6 =  process.env.MQSERVER1_IPv6 ;
FVT.MQSERVER2_IP   =  process.env.MQSERVER2_IP ;
FVT.MQSERVER2_IPv6 =  process.env.MQSERVER2_IPv6 ;
FVT.MQKEY          =  process.env.MQKEY ;

FVT.LDAP_URI = process.env.LDAP_URI ;
FVT.LDAP_SERVER_1 = process.env.LDAP_SERVER_1 ;
FVT.LDAP_SERVER_1_PORT = process.env.LDAP_SERVER_1_PORT ;
FVT.LDAP_SERVER_1_SSLPORT = process.env.LDAP_SERVER_1_SSLPORT ;

FVT.uriConfigDomain = '/ima/'+ FVT.version +'/configuration/';
FVT.uriMonitorDomain = '/ima/'+ FVT.version +'/monitor/';
FVT.uriServiceDomain = '/ima/'+ FVT.version +'/service/';
FVT.uriFileDomain = '/ima/'+ FVT.version +'/file/';
FVT.uriBridgeDomain = '/admin/';

FVT.responseHeaderProductName = '${IMA_PRODUCTNAME_FULL}' ;

FVT.responseHeaderContentTypeJSON = 'application/json' ;
FVT.responseHeaderContentTypePlain = 'text/plain;charset=utf-8' ;

FVT.responseHeaderConnection = 'close' ;
FVT.responseHeaderKeepAlive = 'timeout=60' ;
FVT.responseHeaderCacheControl = 'no-cache' ;

// verifyThis will have the JSON Data:  JSON.parse( expectDefault)
var verifyThis = {} ;
var verifyMessage = { "Version":"'+ FVT.version +'","Code":"CWLNA####","Message":"There will be some text here" } ;
var indent = "        ";

FVT.DEBUG = 2 ;
FVT.MQConnState = false;

var GVTesting = true ;
//-----  No GVT Chars
if ( GVTesting == false ) {
    FVT.long16Name = 'a16_CharName3456';
    FVT.long17Name = 'a17_CharName34567';
    FVT.long20Name = 'a20_CharName11111112';
    FVT.long21Name = 'a21_CharName111111121';
    FVT.long32Name = 'a32aCharName11111112222222222312';
    FVT.long33Name = 'a33ACharName111111122222222223123';
// QMgr, Queues, Topics, Subscriptions, Channels and Listeners Names have restricted CharSet and length of 48 [Aa-Zz 0-9 / % _]
    FVT.long48MQName = 'a48_CharName111111122222222223333333333412345678';
    FVT.long48Name = 'a48_CharName111111122222222223333333333412345678';
    FVT.long49Name = 'a49_CharName1111111222222222233333333334123456789';
    FVT.long128Name = 'a128_CharName1111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111212345678';
    FVT.long129Name = 'a129_CharName11111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112123456789';
    FVT.long254Name = '255_CharName11111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444512345';
    FVT.maxFileName255 = 'm255_CharName11111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444512345';
    FVT.long256Name =    'a256_CharName111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445123456';
    FVT.long257Name =    'a257_CharName1111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444451234567';
    FVT.long1024String = 'a1024_CharNameDescription222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234';
    FVT.long1025String = 'a1025_CharNameDescription2222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111212345';
    FVT.long1024TopicName = '/1024CharNameTopicName222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234';
    FVT.long1025TopicName = '/1025CharNameTopicName2222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111212345';
    FVT.topicLevel32 = 'one/two/three/four/five/six/seven/eight/nine/ten/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27/28/29/30/31/32/topic';
    FVT.topicLevel33 = 'one/two/three/four/five/six/seven/eight/nine/ten/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27/28/29/30/31/32/33/topic';
    //MQ Queues have restricted CharSet
    FVT.long48MQTopicName = '/TOPICNAME48.11111122222222223333333333412345678';
    FVT.long48MQQueueName = 'QUEUENAME48.111111122222222223333333333412345678';
    FVT.long2048HTTP = 'http://a2048CharURL122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234a2048CharURL1111111122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234';
    FVT.long2049HTTP = 'http://a2049CharURL122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234a2048CharURL11111111222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111212349';
    FVT.long2048HTTPS = 'https://a2048CharURL22222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234a2048CharURL1111111122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234';
    FVT.long2049HTTPS = 'https://a2049CharURL22222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234a2048CharURL11111111222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111212349';
    FVT.long2048FTP = 'ftp://a2048CharURL1122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234a2048CharURL1111111122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234';
    FVT.long2048SCP = 'scp://a2048CharURL1122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234a2048CharURL1111111122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234';
} else {
/* -------------------------------------------------------- *
*  NLS Char Strings need to be encoded. ALT+(#)
Ëœ*    Ã‡(128) \u00C7 , ÃŸ(225) \u00DF , Ã¦(145) \u00E6 , Ã‘(165) \u00D1 , Ã¢(131) \u00E2 , Ã‰(144) \u00C9   Ã‡ÃŸÃ¦rÃ‘Ã¢mÃ‰ 
*    Ã¶(148) \u00F6  , Ã±(164) \u00F1  , Ãª(136) \u00EA  , Ã³(162) \u00F3
*  GVT Char Strings need to be encoded. ALT+(#)
Ëœ*   \4E03 Han Idiograph character  -- crazy t
*   \062A ARABIC LETTER TEH -- happy face
*   \0444 CYRILLIC SMALL LETTER EF -- dp
*   \FF73 KATAKANA LETTER U -- dreidel
*   \0905 DEVANAGARI LETTER A -- yoga ohm
*   \91D1 CJK IDEOGRAPH - House
*  Encoding:  http://www.javascripter.net/faq/escape-encodeuri-upper-ascii.htm
*  Ã‡  becomes  %EF%BF%BD
*  -------------------------------------------------------- */
    FVT.long16Name = 'a16_\u00C7\u00DF\u00E6\u4E03\u00D1\u00E2\u062A\u00C9\u0444\uFF73\u0905\u91D1';
    FVT.long16Name = 'a16_\u00C7\u00DF\u00E6\u4E03\u00D1\u00E2\u062A\u00C9\u0444\uFF73\u0905\u91D1';
    FVT.long17Name = 'a17_\u00C7\u00DF\u00E6\u4E03\u00D1\u00E2\u062A\u00C9\u0444\uFF73\u0905\u91D17';
    FVT.long20Name = 'a20_\u00C7\u00DF\u00E6\u4E03\u00D1\u00E2\u062A\u00C9\u0444\uFF73\u0905\u91D11112';
    FVT.long21Name = 'a21_\u00C7\u00DF\u00E6\u4E03\u00D1\u00E2\u062A\u00C9\u0444\uFF73\u0905\u91D111121';
    FVT.long32Name = 'a32a\u00C7\u00DF\u00E6\u4E03\u00D1\u00E2\u062A\u00C9\u0444\uFF73\u0905\u91D11112222222222312';
    FVT.long33Name = 'a33A\u00C7\u00DF\u00E6\u4E03\u00D1\u00E2\u062A\u00C9\u0444\uFF73\u0905\u91D111122222222223123';
    FVT.long48Name = 'a48_\u00C7\u00DF\u00E6\u4E03\u00D1\u00E2\u062A\u00C9\u0444\uFF73\u0905\u91D111122222222223333333333412345678';
// QMgr, Queues, Topics, Subscriptions, Channels and Listeners Names have restricted CharSet and length of 48 [Aa-Zz 0-9 / % _]
    FVT.long48MQName = 'a48_CharName111111122222222223333333333412345678';
    FVT.long49Name = 'a49_\u00C7\u00DF\u00E6\u4E03\u00D1\u00E2\u062A\u00C9\u0444\uFF73\u0905\u91D1111222222222233333333334123456789';
    FVT.long128Name = 'a128_\u00C7\u00DF\u00E6\u4E03\u00D1\u00E2\u062A\u00C9\u0444\uFF73\u0905\u91D1112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111212345678';
    FVT.long129Name = 'a129_\u00C7\u00DF\u00E6\u4E03\u00D1\u00E2\u062A\u00C9\u0444\uFF73\u0905\u91D11122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112123456789';
//  Used for FILE SYSTEM names, append letter to front to get MAXLENGTH  --  FileSystem may not allow GVT chars - they get encoded and corrupted:  http://169.53.146.8:9089/ima/v1/file/C255_%C3%87%C3%9F%C3%A6r%C3%91%C3%A2m%C3%89111111
//    FVT.long254Name = '255_\u00C7\u00DF\u00E6\u4E03\u00D1\u00E2\u062A\u00C9\u0444\uFF73\u0905\u91D111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444512345';
    FVT.long254Name =    '255_CharName11111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444512345';
    FVT.maxFileName255 = 'm255_CharName11111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444512345';
    FVT.long256Name =    'a256_\u00C7\u00DF\u00E6\u4E03\u00D1\u00E2\u062A\u00C9\u0444\uFF73\u0905\u91D111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445123456';
    FVT.long257Name =    'a257_\u00C7\u00DF\u00E6\u4E03\u00D1\u00E2\u062A\u00C9\u0444\uFF73\u0905\u91D1112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444451234567';
    FVT.long1024String = 'a1024_\u00C7\u00DF\u00E6\u4E03\u00D1\u00E2\u062A\u00C9\u0444\uFF73\u0905\u91D1Description33333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234';
    FVT.long1025String = 'a1025_\u00C7\u00DF\u00E6\u4E03\u00D1\u00E2\u062A\u00C9\u0444\uFF73\u0905\u91D1Description333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111212345';
    FVT.long1024TopicName = '/1024\u00C7\u00DF\u00E6\u4E03\u00D1\u00E2\u062A\u00C9\u0444\uFF73\u0905\u91D1TopicName22233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234';
    FVT.long1025TopicName = '/1025\u00C7\u00DF\u00E6\u4E03\u00D1\u00E2\u062A\u00C9\u0444\uFF73\u0905\u91D1TopicName222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111212345';
    FVT.topicLevel31 = '\u00F6\u00F1\u00EA/tw\u00F3/three/four/five/six/seven/eight/nine/ten/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27/28/29/30/31/topic';
    FVT.topicLevel32 = '\u00F6\u00F1\u00EA/tw\u00F3/three/four/five/six/seven/eight/nine/ten/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27/28/29/30/31/32/topic';
    FVT.topicLevel33 = '\u00F6\u00F1\u00EA/tw\u00F3/three/four/five/six/seven/eight/nine/ten/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27/28/29/30/31/32/33/topic';
    FVT.long2048Name = 'a2048_\u00C7\u00DF\u00E6\u4E03\u00D1\u00E2\u062A\u00C9\u0444\uFF73\u0905\u91D11122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234a2048CharURL1111111122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122018';
    //MQ Queues have restricted CharSet
    FVT.long48MQTopicName = '/TOPICNAME48.11111122222222223333333333412345678';
    FVT.long48MQQueueName = 'QUEUENAME48.111111122222222223333333333412345678';
// URI can not have GVT chars... defect 116471
//    FVT.long2048HTTP = 'http://a2048\u00C7\u00DF\u00E6rURL122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234a2048CharURL1111111122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234';
//    FVT.long2048HTTP = 'http://a2048\u00C7\u00DF\u00E6rURL122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234a2048CharURL1111111122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234';
//    FVT.long2049HTTP = 'http://a2049%C3%87%C3%9F%C3%A66rURL122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234a2048CharURL11111111222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111212349';
//    FVT.long2048HTTPS = 'https://a2048\u00C7\u00DF\u00E6rURL22222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234a2048CharURL1111111122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234';
//    FVT.long2049HTTPS = 'https://a2049\u00C7\u00DF\u00E6rURL22222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234a2048CharURL11111111222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111212349';
//    FVT.long2048FTP = 'ftp://a2048\u00C7\u00DF\u00E6rURL1122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234a2048CharURL1111111122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234';
//    FVT.long2048SCP = 'scp://a2048\u00C7\u00DF\u00E6rURL1122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234a2048CharURL1111111122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234';

    FVT.long2048HTTP = 'http://a2048CharURL122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234a2048CharURL1111111122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234';
    FVT.long2049HTTP = 'http://a2049CharURL122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234a2048CharURL11111111222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111212349';
    FVT.long2048HTTPS = 'https://a2048CharURL22222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234a2048CharURL1111111122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234';
    FVT.long2049HTTPS = 'https://a2049CharURL22222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234a2048CharURL11111111222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111212349';
    FVT.long2048FTP = 'ftp://a2048CharURL1122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234a2048CharURL1111111122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234';
    FVT.long2048SCP = 'scp://a2048CharURL1122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234a2048CharURL1111111122222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111121234';
} 
console.log( 'GVT Testing:' + GVTesting + ',  FVT.long16Name: ' + FVT.long16Name );

// MAX Length List of IPs for ClientAddress or other fields
FVT.MAX_LISTMEMBERS = 100 ;
FVT.IP_ADDRESS_STEM = '9.3.179.' ;
FVT.CLIENTADDRESSLIST = FVT.IP_ADDRESS_STEM + '1';
FVT.CLIENT_ADDRESS_LIST = FVT.IP_ADDRESS_STEM + '1';

for  ( var i = 2 ; i <= FVT.MAX_LISTMEMBERS ; i++ ) {
    FVT.CLIENT_ADDRESS_LIST = FVT.CLIENT_ADDRESS_LIST + ', ' + FVT.IP_ADDRESS_STEM + i ;
    FVT.CLIENTADDRESSLIST = FVT.CLIENTADDRESSLIST + ',' + FVT.IP_ADDRESS_STEM + i ;
 
} 

/*******************************/
/*    Plugin Common Variables  */
/*******************************/
FVT.json_msgPlugin         = '{"Plugin": {"json_msg":{"File":"jsonplugin.zip","PropertiesFile":""}}, "Version": "' + FVT.version + '" }';
FVT.json_msgPluginProperty = '{"Plugin": {"json_msg":{"File":"jsonplugin.zip","PropertiesFile":"jsonplugin.json"}}, "Version": "' + FVT.version + '" }';
FVT.json_msgPluginProperty1 = '{"Plugin": {"json_msg":{"File":"jsonplugin.zip","PropertiesFile":"jsonplugin1.json"}}, "Version": "' + FVT.version + '" }';
FVT.json_msgPlugin2          = '{"Plugin": {"json_msg":{"File":"jsonplugin2.zip","PropertiesFile":""}}, "Version": "' + FVT.version + '" }';
FVT.json_msgPlugin2Property  = '{"Plugin": {"json_msg":{"File":"jsonplugin2.zip","PropertiesFile":"jsonplugin.json"}}, "Version": "' + FVT.version + '" }';
FVT.json_msgPlugin2Property1 = '{"Plugin": {"json_msg":{"File":"jsonplugin2.zip","PropertiesFile":"jsonplugin1.json"}}, "Version": "' + FVT.version + '" }';
FVT.json_msgPlugin2Property2 = '{"Plugin": {"json_msg":{"File":"jsonplugin2.zip","PropertiesFile":"jsonplugin2.json"}}, "Version": "' + FVT.version + '" }';

FVT.restmsgPlugin = '{"Plugin":{"restmsg":{"File":"restplugin.zip","PropertiesFile": "package.json"}}, "Version": "' + FVT.version + '" } ';

FVT.allPlugins = '{"Plugin":{"json_msg":{"File":"jsonplugin2.zip","PropertiesFile":"jsonplugin2.json" } , \
                                "restmsg":{"File":"restplugin.zip","PropertiesFile": "package.json"}}, "Version": "' + FVT.version + '" } ';

FVT.defaultProtocol = '{"Version": "' + FVT.version + '" , "Protocol": { \
 "jms": { "UseTopic": true, "UseQueue": true,  "UseShared": true, "UseBrowse": true }, \
 "mqtt":{ "UseTopic": true, "UseQueue": false, "UseShared": true, "UseBrowse": false } }} ' ;

FVT.json_msgProtocol = '{"Version": "' + FVT.version + '" , "Protocol": { \
 "jms": { "UseTopic": true, "UseQueue": true,  "UseShared": true, "UseBrowse": true }, \
 "json_msg":{ "UseTopic": true, "UseQueue": false, "UseShared": false, "UseBrowse": false }, \
 "mqtt":{ "UseTopic": true, "UseQueue": false, "UseShared": true, "UseBrowse": false } }} ' ;

FVT.restmsgProtocol = '{"Version": "' + FVT.version + '" , "Protocol": { \
 "jms":{ "UseTopic": true, "UseQueue": true,  "UseShared": true, "UseBrowse": true }, \
 "json_msg":{ "UseTopic": true, "UseQueue": false, "UseShared": false, "UseBrowse": false }, \
 "restmsg":{ "UseTopic": true, "UseQueue": false, "UseShared": false, "UseBrowse": false }, \
 "mqtt":{ "UseTopic": true, "UseQueue": false, "UseShared": true, "UseBrowse": false } }} ' ;

// Don't get JSON back, I get PLAIN TEXT
//FVT.json_msgProperties = { "Name":"json_msg", "Protocol":"json_msg", "Classpath": [ "jsonprotocol.jar" ], "Class":"com.ibm.ima.samples.plugin.jsonmsg.JMPlugin", "WebSocket": [ "json-msg" ], "InitialByte": [ "{" ], "UseQueue": false, "UseTopic": true, "Properties": {"Debug": true, "UpdatedConfigProperty": true} } ;
FVT.json_msgProperties = '/*\n * * Copyright (c) 2015-2021 Contributors to the Eclipse Foundation\n * See the NOTICE file(s) distributed with this work for additional\n * information regarding copyright ownership.\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0\n * SPDX-License-Identifier: EPL-2.0\n *\n * This file defined the Amlen plug-in for the json_msg sample protocol.\n */\n{\n    /*\n     * The name of the plug-in.  This must be unique among all installed plug-ins.  The name is limited \n     * to 64 characters and must be a valid Java name.  It can start with any alphabetic character, \n     * currency symbol, or underscore, and continue with any such character or a digit.\n     */\n    \"Name\":        \"json_msg\",\n    \n    /* \n     * The protocol family against which to authorize.  Each plug-in represents a single protocol family, \n     * but the same protocol family may be used by several plug-ins.  The plug-in can also use one of the \n     * system protocol families.  All policy checking for protocol is done based on this protocol.\n     * The name must be limited to 64 characters and must contain only ASCII-7 characters not including \n     * control characters (0x00 to 0x1F and x07F), space, or the separator characters \'()<>[]{},;:\\/?=\".  \n     */\n    \"Protocol\":    \"json_msg\",\n    \n    /* \n     * A set of jar files containing the Java classes needed for the plug-in as a JSON array of strings.  \n     * This must not include the path, and these jar files should be in the root directory of the zip file \n     * used to define the plug-in.  These jar files are used only by this plug-in using a separate directory \n     * and class loader for each plug-in.  The file must exist in the zip file used for install. \n     */ \n    \"Classpath\":   [ \"jsonprotocol.jar\" ],\n    \n    /*\n     * The name of the initial class to load for a plug-in.  This must be an instance of ImaPluginListener.  \n     * This must be a valid Java package name and class name separated by dots.\n     */\n    \"Class\":       \"com.ibm.ima.samples.plugin.jsonmsg.JMPlugin\",\n    \n    /*\n     * An array of WebSockets sub-protocols supported by this plug-in.  These are checked in a case independent \n     * manor.  These should be unique among the installed plug-in set.  If this property is missing or the array \n     * is empty, then no WebSockets protocol will connect to this plug-in.  The name must be limited to 64 characters \n     * and must contain only ASCII-7 characters not including control characters (0x00 to 0x1F and x07F), \n     * space, or the separator characters \'()<>[]{},;:\\/?=\".  \n     */\n    \"WebSocket\":   [ \"json-msg\" ],\n    \n    /*\n     * A set of initial bytes which can be specified as an array of strings of length 1 byte or as integers \n     * of the value 0-255.  A single entry with the value \"ALL\" indicates that any initial byte will be selected.  \n     * If this is not specified or the array is empty, then TCP connections will not be accepted.\n     */\n    \"InitialByte\": [ \"{\" ],       /* The json_msg always starts with a JSON object */\n    \n    /*\n     * Define the capabilities of the plug-in\n     */\n    \"UseQueue\":    false,         /* This plug-in does not implement queues */\n    \"UseTopic\":    true,          /* This plug-in implemetns topics */\n\n    /* \n     * A set of properties which are sent to the plug-in as configuration.\n     * The names and types of the properties are not known to the Amlen server\n     */  \n    \"Properties\": {\n        \"Debug\": true,\n        \"UpdatedConfigProperty\": true\n    }\n}\n       \n\n' ;

//FVT.json_msgProperties2 = { "Name":"json_msg", "Protocol":"json_msg", "Classpath": [ "jsonprotocol.jar" ], "Class":"com.ibm.ima.samples.plugin.jsonmsg.JMPlugin", "WebSocket": [ "json-msg" ], "InitialByte": [ "{" ], "UseQueue": false, "UseTopic": true, "Properties": {"Debug": false, "UpdatedConfigProperty": true} } ;
FVT.json_msgProperties2 = '/*\n * * Copyright (c) 2015-2021 Contributors to the Eclipse Foundation\n * See the NOTICE file(s) distributed with this work for additional\n * information regarding copyright ownership.\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0\n * SPDX-License-Identifier: EPL-2.0\n *\n * This file defined the Amlen plug-in for the json_msg sample protocol.\n */\n{\n    /*\n     * The name of the plug-in.  This must be unique among all installed plug-ins.  The name is limited \n     * to 64 characters and must be a valid Java name.  It can start with any alphabetic character, \n     * currency symbol, or underscore, and continue with any such character or a digit.\n     */\n    \"Name\":        \"json_msg\",\n    \n    /* \n     * The protocol family against which to authorize.  Each plug-in represents a single protocol family, \n     * but the same protocol family may be used by several plug-ins.  The plug-in can also use one of the \n     * system protocol families.  All policy checking for protocol is done based on this protocol.\n     * The name must be limited to 64 characters and must contain only ASCII-7 characters not including \n     * control characters (0x00 to 0x1F and x07F), space, or the separator characters \'()<>[]{},;:\\/?=\".  \n     */\n    \"Protocol\":    \"json_msg\",\n    \n    /* \n     * A set of jar files containing the Java classes needed for the plug-in as a JSON array of strings.  \n     * This must not include the path, and these jar files should be in the root directory of the zip file \n     * used to define the plug-in.  These jar files are used only by this plug-in using a separate directory \n     * and class loader for each plug-in.  The file must exist in the zip file used for install. \n     */ \n    \"Classpath\":   [ \"jsonprotocol.jar\" ],\n    \n    /*\n     * The name of the initial class to load for a plug-in.  This must be an instance of ImaPluginListener.  \n     * This must be a valid Java package name and class name separated by dots.\n     */\n    \"Class\":       \"com.ibm.ima.samples.plugin.jsonmsg.JMPlugin\",\n    \n    /*\n     * An array of WebSockets sub-protocols supported by this plug-in.  These are checked in a case independent \n     * manor.  These should be unique among the installed plug-in set.  If this property is missing or the array \n     * is empty, then no WebSockets protocol will connect to this plug-in.  The name must be limited to 64 characters \n     * and must contain only ASCII-7 characters not including control characters (0x00 to 0x1F and x07F), \n     * space, or the separator characters \'()<>[]{},;:\\/?=\".  \n     */\n    \"WebSocket\":   [ \"json-msg\" ],\n    \n    /*\n     * A set of initial bytes which can be specified as an array of strings of length 1 byte or as integers \n     * of the value 0-255.  A single entry with the value \"ALL\" indicates that any initial byte will be selected.  \n     * If this is not specified or the array is empty, then TCP connections will not be accepted.\n     */\n    \"InitialByte\": [ \"{\" ],       /* The json_msg always starts with a JSON object */\n    \n    /*\n     * Define the capabilities of the plug-in\n     */\n    \"UseQueue\":    false,         /* This plug-in does not implement queues */\n    \"UseTopic\":    true,          /* This plug-in implemetns topics */\n\n    /* \n     * A set of properties which are sent to the plug-in as configuration.\n     * The names and types of the properties are not known to the Amlen server\n     */  \n    \"Properties\": {\n        \"Debug\": false,\n        \"UpdatedConfigProperty\": true\n    }\n}\n       \n\n' ;

// package.JSON does return as JSON! 
//FVT.packageProperties = '{\n"name": "messagesight-rest-test",\n"version": "0.0.1",\n"description": "Example Mocha tests for MessageSight REST API",\n"scripts": {\n"test": "export IMA_AdminEndpoint=10.77.207.53:9089; mocha"\n},\n"dependencies": {"dns":"*","expect":"*",\n"request": "*",\n"should": "*",\n"supertest": "*",\n"mocha": "*",\n"mqtt": "*"\n},\n"engines": {\n"node": "0.12.3"\n},\n"repository": {}\n}\n' ;
//FVT.packageProperties =   "{\\n\"name\": \"messagesight-rest-test\",\\n\"version\": \"0.0.1\",\\n\"description\": \"Example Mocha tests for MessageSight REST API\",\\n\"scripts\": {\\n\"test\": \"export IMA_AdminEndpoint=10.77.207.53:9089; mocha\"\\n},\\n\"dependencies\": {\"dns\":\"*\",\"expect\":\"*\",\\n\"request\": \"*\",\\n\"should\": \"*\",\\n\"supertest\": \"*\",\\n\"mocha\": \"*\",\\n\"mqtt\": \"*\"\\n},\\n\"engines\": {\\n\"node\": \"0.12.3\"\\n},\\n\"repository\": {}\\n}\\n\\n"
//FVT.packageProperties =   "{\n\"name\": \"messagesight-rest-test\",\n\"version\": \"0.0.1\",\n\"description\": \"Example Mocha tests for MessageSight REST API\",\n\"scripts\": {\n\"test\": \"export IMA_AdminEndpoint=10.77.207.53:9089; mocha\"\n},\n\"dependencies\": {\"dns\":\"*\",\"expect\":\"*\",\n\"request\": \"*\",\n\"should\": \"*\",\n\"supertest\": \"*\",\n\"mocha\": \"*\",\n\"mqtt\": \"*\"\n},\n\"engines\": {\n\"node\": \"0.12.3\"\n},\n\"repository\": {}\n}\n\n"
FVT.packageProperties =   {"name": "messagesight-rest-test", "version": "0.0.1", "description": "Example Mocha tests for MessageSight REST API", "scripts": { "test": "export IMA_AdminEndpoint=10.77.207.53:9089; mocha" }, "dependencies": {"dns":"*","expect":"*", "request": "*", "should": "*", "supertest": "*", "mocha": "*", "mqtt": "*" }, "engines": { "node": "6.9.4" }, "repository": {}} ;
FVT.restmsgProperties = { "Name":"restmsg", "Protocol":"restmsg", "Classpath": [ "restprotocol.jar" ], "Class":"com.ibm.ima.samples.plugin.restmsg.RestMsgPlugin", "WebSocket": [], "Alias": "/restmsg", "InitialByte": [], "HttpHeader": [ "ClientID", "Content-Type" ], "UseQueue": false, "UseTopic": true, "Properties": {"Debug": true } } ;

// Export ClientSet RequestID for tracking
FVT.RequestID = [];

// Import Export ClientSet Async ReqeustID Array - built in exportSuccessCallback
FVT.getRequestID = function( RequestIDName ) {
    FVT.trace( 2,  "RequestID[]'s:"+  JSON.stringify( FVT.RequestID ) +" looking for "+ RequestIDName );

    for ( var i = 0; i < FVT.RequestID.length; i++ ){
//        console.log( "FVT.RequestID["+ i +"]=" + FVT.RequestID[i] +" looking for "+ RequestIDName);
        obj = JSON.parse( FVT.RequestID[i] );
        for ( var key in obj ) {
            FVT.trace( 4, "key: " + key );
            if ( key === RequestIDName ) {
                FVT.trace( 4, "value: " + obj[ RequestIDName ] );
                return obj[ RequestIDName ] ;
            };
        };
    };
    FVT.trace( 0, "RequestID key " +  RequestIDName +" was NOT FOUND!" );
    return undefined;
};

FVT.SESSION_EXPIRY_TEST = process.env.SESSION_EXPIRY_TEST;


/*
 * Encoding the first '/' in path causes an error, need to work around that and still enocde for special chars in Names
 */
encodeDomain = function( path ){
    encodedPath = encodeURI(domain);
//encodeURIComponent(domain);   This encoded too much, see:  http://www.w3schools.com/jsref/jsref_encodeURI.asp
};


/* 
 *  Walk the JSON expectedObject and verify it's contens exist in the response.
 */
function verifyFields( expectObject, response ){
var SAVE_DEBUG=FVT.DEBUG;
FVT.DEBUG=4;
    
    var responseCount = response.length ;                      // # of members in response Array (indices)
    var expectedMatches = Object.keys(expectObject).length  ;  // # of members in expectObject Array
    var actualMatches = 0;                                     // # of expectObject and Response matched objects

    if ( expectedMatches == 0 && responseCount == 0 ) {
        FVT.trace( 0, 'Both expected and actual are empty arrays, and that is a match.');
    } else if ( expectedMatches == 0 && responseCount > 0 ) {
        var msg = 'Failed to validate:   The Expected result is '+ expectedMatches +' members in RESPONSE array, yet '+ responseCount +' members are in the RESPONSE array.' ;
        FVT.trace( 0, msg );
        verifyMessage = '' ; verifyThis = '' ;
        throw new Error(msg);        
    } else {
    
        FVT.trace( 2, "@verifyFields with EXPECTED: " + JSON.stringify(expectObject) + " .vs. ACTUAL: " + JSON.stringify(response) );
        for (var key in expectObject) {
            if (response.hasOwnProperty( key )) {
                var val = expectObject[key];
                FVT.trace( 4,"Expected KEY: " + key + " HAS VALUE: " + JSON.stringify(val) +" WITH TYPEOF: "+ typeof val);
                if ( typeof val != "object" || (typeof val == "object" && JSON.stringify(val) == "null" ) ) {
                    FVT.trace( 4,"Actual KEY: " + key + " HAS VALUE: " + JSON.stringify(response[key]) +" WITH TYPEOF: "+ typeof response[key]);
                    if ( val === "XXXXXX" ) {
                        FVT.trace( 4,"!!NOTE!! : Expected Keys with VALUE=XXXXXX are NOT compared, just verify the Key:'+ key+' is in the response and has any value: " + JSON.stringify(response[key]) );
                    } else {
                        if ( response[key] === val ) {
                            FVT.trace( 2, 'For ('+ key +') value ['+response[key] + '] EQUALS expected: [' + expectObject[key] + '].' );
                        } else {
                            FVT.trace( 2, 'For "'+ key +'" value ['+response[key] + '] of type '+ typeof response[key] +' DOES NOT EQUAL expected: [' + expectObject[key] + '] of type: '+ typeof expectObject[key] );
        //                    if ( MOCHA_STOP_FIRST_ERROR === true ) {
        //                        debugger;
        //                    } else {
                                verifyMessage = '' ; verifyThis = '' ;
                                throw new Error('For ('+ key +') value ['+response[key] + '] DOES NOT EQUAL expected: [' + expectObject[key] + '].');
        //                    }
                        }
                    }
                } else {
                    FVT.trace( 5,"Is the KEY in response?");
                    if (response.hasOwnProperty( key )) {
                        FVT.trace( 4,'YES, the KEY is in expected results, more to come');
                    } else {
                        FVT.trace( 4,'NO, the KEY is in expected results, more to come or errexit really....');
                    }
                    verifyFields(val, response[key]);
                }
            } else {
                if ( expectObject[ key ] == null ) {
                    FVT.trace( 2, 'For ('+ key +') value ['+expectObject[key] + '] was correctly not found in the response.' );
                } else {
                    FVT.trace( 0, "Response did not have KEY:"+ key );
    //                if ( MOCHA_STOP_FIRST_ERROR === true ) {
    //                    debugger;
    //                } else {
                            verifyMessage = '' ; verifyThis = '' ;
                            throw new Error('Failed to validate:   Response did not have KEY:'+ key) ;
    //                }
                }
            }
        }
    }
FVT.DEBUG=SAVE_DEBUG
};
 
 
function verifyArray( expectObject, response ){
var SAVE_DEBUG=FVT.DEBUG;
FVT.DEBUG=4;

    FVT.trace( 2, "@verifyArray with EXPECTED: " + JSON.stringify(expectObject) + " .vs. ACTUAL: " + JSON.stringify(response) );
    var responseCount = response.length ;                      // # of members in response Array (indices)
    var expectedMatches = Object.keys(expectObject).length  ;  // # of members in expectObject Array
    var actualMatches = 0;                                     // # of expectObject and Response matched objects

    if ( expectedMatches == 0 && responseCount == 0 ) {
        FVT.trace( 0, 'Both expected and actual are empty arrays, and that is a match.');
    } else if ( expectedMatches == 0 && responseCount > 0 ) {
        var msg = 'Failed to validate:   The Expected result is '+ expectedMatches +' members in RESPONSE array, yet '+ responseCount +' members are in the RESPONSE array.' ;
        FVT.trace( 0, msg );
        verifyMessage = '' ; verifyThis = '' ;
        throw new Error(msg);        
    } else {
        FVT.trace( 0, 'Check the '+ responseCount +' elements in response array for '+ expectedMatches +' exact matches with expectedObject' );
        
        if ( responseCount >= expectedMatches ) {
            
            // for each array member  in the expectObject
            for ( var mem = 0 ; mem < expectedMatches; mem++ ) {   // Expected Object Array Members Loop
            
                var expectKey = expectObject[mem] ;
                console.log ( "expectKey: "+ JSON.stringify(expectKey)  +' is TYPE'+  typeof expectKey +' and it value '+ JSON.stringify( expectObject[expectKey] ));
                // TopicMonitor, is just a list of topics, not K:V pairs.
                if ( typeof expectKey !== "string" ) {
                    // Get the first key[0] of expectObject's member#[mem]  (didn't find a way to do this other than a FOR) 
                    for(  var key in expectObject[mem] ) {

                        var totalKeys = Object.keys( expectObject[mem] ).length ;
                        FVT.trace( 4, "FirstKey of Expected["+mem+"] is: "+key+" and there are "+totalKeys+" keys to match: "+JSON.stringify( expectObject[mem] ) +"."  );

                        // compare against each response member
                        for ( var rmem = 0 ; rmem < responseCount ; rmem++ ) {  // RESPONSE Member Loop
                            // does this response member have a matching key
                            if ( response[rmem].hasOwnProperty(key) ) {
                                FVT.trace( 4, "First key matches, does this values match? "+ expectObject[mem][key] );
                                if ( response[rmem][key] === expectObject[mem][key] ) {
                                    FVT.trace( 4, "First K:V pair match, check ALL KEYS in that member" );
                                    var currentMatch = 1;   // Assume a complete match unless find where it is not
                                    // For each key in the Expected member, look for a match in the RESPONSE member
                                    for ( var eKey in expectObject[mem] ) {   //Expected Object KEYS to match loop
                                        var eValue = expectObject[mem][eKey] ;
                                        if ( response[rmem].hasOwnProperty( eKey ) ) {
                                            if( response[rmem][eKey] === expectObject[mem][eKey] ) {
                                                FVT.trace( 4, 'K:Value match: '+ eKey +':'+eValue ) ;
                                                continue;
                                            } else {
                                               FVT.trace( 4, 'RESPONSE Element#'+rmem+' value, '+ response[rmem][eKey] +'.failed to match expected: '+ eKey +':'+ expectObject[mem][eKey] );
                                               currentMatch = 0;
                                               break;
                                            }
                                        } else {
                                            FVT.trace( 4, 'RESPONSE Element#'+rmem+' failed to match key: '+ eKey );
                                            currentMatch = 0;
                                            break;
                                        }
                                    }  // END OF :  Expected Object KEYS to match loop
                                    if ( currentMatch == 1 ) {
                                        // Match was found in RESPONSE, break out of the RESPONSE Member loop
                                        actualMatches++;
                                        FVT.trace( 0 , "So far: "+ actualMatches +" Actual Matches out of "+ expectedMatches );
                                        break;
                                    }
                                    // match increments currentMatch
                                } else {
                                    FVT.trace( 4, "Keys match, yet Value, "+response[rmem][key]+"'did not match, go to next Response member" );
                                }
                            } else {
                                FVT.trace( 4, "Key, "+ key +",was not found in RESPONSE#"+rmem+", go to next Response member." );
                            }

                        }  // END OF: RESPONSE Member Loop
                        //  If current match was not found, no point in continuing 
                        if ( currentMatch == 0 ) {
                            var msg = "Failed to validate:   The Expected member#"+mem+" did not match RESPONSE, TERMINATE Comparison at: "+ JSON.stringify(expectObject[mem]) ;
                            FVT.trace( 0, msg );
                            verifyMessage = '' ; verifyThis = '' ;
                            throw new Error(msg)  ; 
                            
                        } else {
                            // Found a match, don't need to iterate this FOR on KEYS since it was done already (didn't know how to get the first key, so used FOR LOOP)
                            break;
                        }
                    }
                } else {  //TopicMonitor lists are expected here
                    if ( JSON.stringify(expectObject) != JSON.stringify(response) ) {
                        var msg = "Failed to validate:   (TopicMonitor?) expectedObject "+ JSON.stringify(expectObject) +" did not match RESPONSE, TERMINATE Comparison at: "+ JSON.stringify(response) ;
                        FVT.trace( 0, msg );
                        throw new Error(msg);
                    } else { 
                        actualMatches++;
                    }
                }
            }  // END OF: Expected Object Array Members Loop
        } else {
            var msg = 'Failed to validate:   Response has fewer KEYs, '+ responseCount +' than were in the expectedMatches '+ expectedMatches ;
            FVT.trace( 0, msg );
            verifyMessage = '' ; verifyThis = '' ;
            throw new Error(msg)  ;            
        }
        if ( actualMatches == expectedMatches ){ 
            FVT.trace( 0, "ALL Expected array members were found in RESPONSE");
        } else {
            var msg = "NOT ALL the Expected array members were found in RESPONSE. Only matched "+ actualMatches +" of "+ expectedMatches +" Expected Matches.";
            FVT.trace( 0, msg );
            verifyMessage = '' ; verifyThis = '' ;
            throw new Error(msg)  ;            
        }
    }
FVT.DEBUG=SAVE_DEBUG
};


/* 
**  Set FVT.MQConnState with value of key:  MQConnectivityEnabled so it can be reset.
*/
FVT.getMQConnStateCallback = function(err, res, done ){
    FVT.trace( 0, "RESPONSE:"+ JSON.stringify( res, null, 2 ) );
    jsonResponse = JSON.parse( res.text );
    FVT.MQConnState = jsonResponse.MQConnectivityEnabled ;
    FVT.trace( 1, 'The MQConnectivityEnabled: '+ FVT.MQConnState );
    verifyMessage = '' ; verifyThis = '' ;
    done();
}


/*
 * Verify the response of a successful post request
 */
FVT.postSuccessCallback = function(err, res, done) {
    FVT.trace( 0, "PostSuccessCallback Response:  "+ JSON.stringify(res, null, 2) );
// 102118 - Validate Header lines
    FVT.trace( 5, 'Content-length: '+ res.header['content-length'] + " .vs. response.text.length(): " + res.text.length);
//    res.text.length.should.equal(  Number( res.header['content-length'] )  );   // TraceBackupDestination fails on this
    res.header['server'].should.equal( FVT.responseHeaderProductName );
    res.header['access-control-allow-credentials'].should.equal( "true" );
    res.header['connection'].should.equal( FVT.responseHeaderConnection ) ;
    res.header['keep-alive'].should.equal( FVT.responseHeaderKeepAlive ) ;
    res.header['cache-control'].should.equal( FVT.responseHeaderCacheControl ) ;
/*    
    if ( JSON.stringify( res.req[url] ).indexOf( FVT.uriServiceDomain ) >= 0 ) {
        res.header['content-type'].should.equal( FVT.responseHeaderContentTypePlain );
    } else {
        res.header['content-type'].should.equal( FVT.responseHeaderContentTypeJSON );
    }
*/
    if (err) {
        FVT.trace( 0, "PostSuccessCallback ERROR:  "+ String(err) );
        FVT.lastPost['stats'][ "status" ] = res.statusCode ;
        responseText = JSON.parse( res.text);
//        if ( MOCHA_STOP_FIRST_ERROR === true ) {
//            debugger;
//        } else {
            verifyMessage = '' ; verifyThis = '' ;
            throw new Error(err +' RESPONSE: '+ JSON.stringify( responseText ));
//        }
    }
    
//    FVT.trace( 2, "PostSuccessCallback Response:  "+ JSON.stringify( res, null, 2) );

    // Check an HTTP return code
    FVT.lastPost['stats'][ "status" ] = res.statusCode ;
    if ( verifyMessage.status ) {
        res.statusCode.should.equal( verifyMessage.status );
    } else {
        res.statusCode.should.equal(200);
    }
    FVT.lastPost['stats'][ "PortFrom" ] = FVT.lastPost['stats'][ "PortTo" ];
    FVT.trace( 1, "AdminEndpoint PORT is now: " + FVT.lastPost['stats'][ "PortFrom" ] );

    // Check full response text
    res.should.have.property('text');
    if ( res.text === "" ) {
        FVT.trace( 0, "Response Text object was empty string and THAT's NOT RIGHT!");
    } else {
        var resTEXT = JSON.parse(res.text);
        FVT.trace( 0, "resTEXT: "+ JSON.stringify(resTEXT) +" -- verifyMessage:"+ JSON.stringify(verifyMessage) );
        if  ( verifyMessage.status ) {
            if ( verifyMessage['Code'] ) {
                res.text.should.equal('{ "Version":"'+ FVT.version +'","Code":"'+ verifyMessage.Code +'","Message":"'+ verifyMessage.Message +'" }\n');
                // Check individual response properties
                resTEXT.should.have.property('Version');
                resTEXT.Version.should.equal( FVT.version );
                resTEXT.should.have.property('Code');
                resTEXT.Code.should.equal( verifyMessage.Code )
                resTEXT.should.have.property('Message');
                resTEXT.Message.should.equal( verifyMessage.Message )
            } else { //This is an IMPORT PREVIEW
            console.log ( "verifyThis "+ JSON.stringify(verifyThis) );
            console.log ( "resTEXT "+ JSON.stringify(resTEXT) );
                //resTEXT.should.equal( verifyThis );
                verifyFields( verifyThis, resTEXT );
            }
            
            // ensure subsequent calls are not reading an old value to see is non-std Success message is returned.
            delete verifyMessage.status;
        } else {
            if ( resTEXT.Version ) {
                // MessageSight Response is assumed
                res.text.should.equal('{ \"Version\":\"'+ FVT.version +'\",\"Code\":\"CWLNA6011\",\"Message\":\"The requested configuration change has completed successfully.\" }\n');
                // Check individual response properties
                resTEXT.should.have.property('Message');
                resTEXT.Message.should.equal('The requested configuration change has completed successfully.');
                resTEXT.should.have.property('Version');
                resTEXT.Version.should.equal( FVT.version );
                resTEXT.should.have.property('Code');
                resTEXT.Code.should.equal('CWLNA6011');
            } else {
                // Bridge-Proxy Response is assumed
                //res.text.should.equal( '{ "Code":"CWLNA0000", "Message": "Success" }' );
                // Check individual response properties
                resTEXT.should.have.property('Message');
                resTEXT.Message.should.equal('Success');
                resTEXT.should.not.have.property('Version');
                resTEXT.should.have.property('Code');
                resTEXT.Code.should.equal('CWLNA0000');
            }
        }
    }
    verifyMessage = '' ; verifyThis = '' ;
    done();
};


/*
 * Verify the response of a successful POST request for an EXPORT 
 */
FVT.exportSuccessCallback = function(err, res, done) {
    FVT.trace( 0, "ExportSuccessCallback Response:  "+ JSON.stringify(res, null, 2) );
// 102118 - Validate Header lines
    FVT.trace( 5, 'Content-length: '+ res.header['content-length'] + " .vs. response.text.length(): " + res.text.length);
//    res.text.length.should.equal(  Number( res.header['content-length'] )  );   // TraceBackupDestination fails on this
    res.header['server'].should.equal( FVT.responseHeaderProductName );
    res.header['access-control-allow-credentials'].should.equal( "true" );
    res.header['connection'].should.equal( FVT.responseHeaderConnection ) ;
    res.header['keep-alive'].should.equal( FVT.responseHeaderKeepAlive ) ;
    res.header['cache-control'].should.equal( FVT.responseHeaderCacheControl ) ;
    if (err) {
        FVT.trace( 0, "ExportSuccessCallback ERROR:  "+ String(err) );
        FVT.lastPost['stats'][ "status" ] = res.statusCode ;
        responseText = JSON.parse( res.text);
//        if ( MOCHA_STOP_FIRST_ERROR === true ) {
//            debugger;
//        } else {
            verifyMessage = '' ; verifyThis = '' ;
            throw new Error(err +' RESPONSE: '+ JSON.stringify( responseText )) ;
//        }
    }

    // Check full response text
    res.should.have.property('text');
    if ( res.text === "" ) {
        FVT.trace( 0, "Response Text object was empty string and THAT's NOT RIGHT!");
    } else {
        var resTEXT = JSON.parse(res.text);
        if  (verifyMessage.status) {
            if ( verifyMessage['Code'] ) {
// (Don't know RequestID, therefore can not do WHOLE compare here)
//                res.text.should.equal('{ "Version":"'+ FVT.version +'","Code":"'+ verifyMessage.Code +'","Message":"'+ verifyMessage.Message +'" }\n');
                // Check individual response properties, start with RequestID incase there is a failure (ID is needed for GETs later)
                resTEXT.should.have.property('RequestID');
                console.log( "response REQUESTID:" + resTEXT.RequestID );
                console.log( "verifyMessage placeholder:" + verifyMessage.RequestID );
                console.log( 'Add Element to FVT.RequestID[{"' + verifyMessage.RequestID +'":"'+ resTEXT.RequestID + '"}]' );
                FVT.RequestID.push( '{"' + verifyMessage.RequestID +'":"'+ resTEXT.RequestID + '"}' );    
                console.log ( 'FVT.RequestID[]:' + JSON.stringify( FVT.RequestID, null, 1 ) );
                console.log ( 'JUST ADDED:  '+ FVT.RequestID[FVT.RequestID.length-1] );
                
                resTEXT.should.have.property('Version');
                resTEXT.Version.should.equal( FVT.version );
                resTEXT.should.have.property('Code');
                resTEXT.Code.should.equal( verifyMessage.Code )

                if ( resTEXT.Code == "CWLNA6174" ) {
                    resTEXT.should.have.property('Message');
                    theMessage = verifyMessage.Message.replace("#aRequestID#", resTEXT.RequestID);
                    FVT.trace( 0, "Amended verifyMessage:"+ theMessage );
                    resTEXT.Message.should.equal( theMessage )
                } else {
                    console.log( "resTEXT.Code="+ resTEXT.Code );
                    resTEXT.should.have.property('Message');
                    resTEXT.Message.should.equal( verifyMessage.Message )
                }
            } else { //This is an IMPORT PREVIEW
            console.log ( "verifyThis "+ verifyThis );
            console.log ( "resTEXT "+ resTEXT );
                //resTEXT.should.equal( verifyThis );
                verifyFields( verifyThis, resTEXT );
            }
            
        } else {
            res.text.should.equal('{ "Version":"'+ FVT.version +'","Code":"CWLNA6011","Message":"The requested configuration change has completed successfully." }\n');
            // Check individual response properties
            resTEXT.should.have.property('Message');
            resTEXT.Message.should.equal('The requested configuration change has completed successfully.');
            resTEXT.should.have.property('Version');
            resTEXT.Version.should.equal( FVT.version );
            resTEXT.should.have.property('Code');
            resTEXT.Code.should.equal('CWLNA6011');
        }
    }
    
    // Check an HTTP return code
    FVT.lastPost['stats'][ "status" ] = res.statusCode ;
    if ( verifyMessage.status ) {
        res.statusCode.should.equal( verifyMessage.status );
    } else {
        res.statusCode.should.equal(200);
    }
    FVT.lastPost['stats'][ "PortFrom" ] = FVT.lastPost['stats'][ "PortTo" ];
    FVT.trace( 1, "AdminEndpoint PORT is now: " + FVT.lastPost['stats'][ "PortFrom" ] );

    verifyMessage = '' ; verifyThis = '' ;
    done();
};

/*
 * Verify The outter wrapper in a request.text returned
 * Assumes GLOBAL: VerifyMessage is set with KEYS:  Message, Code
 * Input: jsonResponse = JSON.parse( res.text );  of the original response object
 */
function verifyResponseTextParameter( jsonResponse ) {
var SAVE_DEBUG=FVT.DEBUG;
FVT.DEBUG=4;
    FVT.trace( 3, "@VerifyResponseTextParams: response ("+ JSON.stringify(jsonResponse) +") contain this verifyMessage: ("+ JSON.stringify(verifyMessage) +")" );
    for ( var key in verifyMessage ) {
        if (jsonResponse.hasOwnProperty( key )) {
            var val = verifyMessage[key];
            FVT.trace( 4,"KEY: " + key + " HAS VALUE: " + JSON.stringify(val) +" WITH TYPEOF: "+ typeof val);
            if ( typeof val != "object" ) {
                FVT.trace( 5,"Did KEY returned a jsonResponse with THAT Value?");
                // typeof val is NUMBER then compare is different syntax now
                if (typeof val == "number") {
                    if ( jsonResponse[key] === val ) {
	                    FVT.trace( 2, 'For ('+ key +') value ['+jsonResponse[key] + '] EQUALS expected: [' + verifyMessage[key] +'].');
                    } else {
	                    FVT.trace( 2, 'For- "'+ key +'" value ['+jsonResponse[key] + '] of type '+ typeof jsonResponse[key] +' DOES NOT EQUAL expected: [' + verifyMessage[key] + '] of type: '+ typeof verifyMessage[key] );
	                	//                    if ( MOCHA_STOP_FIRST_ERROR === true ) {
	                	//                        debugger;
	                	//                    } else {
	                	                        var tempKeyValue = verifyMessage[key];
	                	                        verifyMessage = '' ; verifyThis = '' ;
	                	                        throw new Error('For ('+ key +') value: ['+jsonResponse[key] + '] DOES NOT EQUAL expected: [' + tempKeyValue +'].');
	                	//                    }
                    }
                    
                } else {
                // ASSUME typeof val is STRING
	                if ( jsonResponse[key].startsWith(val) ) {
	                    FVT.trace( 2, 'For ('+ key +') value ['+jsonResponse[key] + '] EQUALS expected: [' + verifyMessage[key] +'].');
	                } else {
	                    FVT.trace( 2, 'For- "'+ key +'" value ['+jsonResponse[key] + '] of type '+ typeof jsonResponse[key] +' DOES NOT EQUAL expected: [' + verifyMessage[key] + '] of type: '+ typeof verifyMessage[key] );
	//                    if ( MOCHA_STOP_FIRST_ERROR === true ) {
	//                        debugger;
	//                    } else {
	                        var tempKeyValue = verifyMessage[key];
	                        verifyMessage = '' ; verifyThis = '' ;
	                        throw new Error('For ('+ key +') value: ['+jsonResponse[key] + '] DOES NOT EQUAL expected: [' + tempKeyValue +'].');
	//                    }
	                }
                }
            } else {
                FVT.trace( 5,"Is the KEY, "+ key +" in jsonResponse?");
                if (jsonResponse.hasOwnProperty( key )) {
                    FVT.trace( 4,'YES, the KEY is in expected results, more to come');
                } else {
                    FVT.trace( 4,'NO, the KEY is in expected results, more to come or errexit really....');
                }
                verifyFields(val, jsonResponse[key]);
            }
        } else {
            if ( verifyMessage[ key ] == null ) {
                FVT.trace( 2, 'For ('+ key +') value ['+verifyMessage[key] + '] was correctly not found in the response.' );
            } else {
                FVT.trace( 0, "jsonResponse did not have KEY:"+ key );
//                if ( MOCHA_STOP_FIRST_ERROR === true ) {
//                    debugger;
//                } else {
                    verifyMessage = '' ; verifyThis = '' ;
                    throw new Error('Failed to validate: '+ jsonResponse.req.url +' Response did not have KEY:'+ key) ;
//                }
            }
        }
    
    }
FVT.DEBUG=SAVE_DEBUG;
};

/*
 * Verify the response of a failed post request
 */
FVT.postFailureCallback = function(err, res, done) {
    if( err ) {
        FVT.trace( 0, "PostFailureCallback (err):  "+ err );
        FVT.trace( 0, "PostFailureCallback (err) Response:  "+ JSON.stringify(err, null, 2) );
        FVT.lastPost['stats'][ "status" ] = 400 ;
    // 102118 - Validate Header lines - THERE ARE NOT ANY MOST TIMES
    } 
    if ( res ) {
        FVT.trace( 0, "PostFailureCallback Response:  "+ JSON.stringify(res, null, 2) );
    // 102118 - Validate Header lines
        FVT.trace( 5, 'Content-length: '+ res.header['content-length'] + " .vs. response.text.length(): " + res.text.length);
    //    res.text.length.should.equal(  Number( res.header['content-length'] )  );
        res.header['server'].should.equal( FVT.responseHeaderProductName );
        res.header['access-control-allow-credentials'].should.equal( "true" );
        res.header['connection'].should.equal( FVT.responseHeaderConnection ) ;
        res.header['keep-alive'].should.equal( FVT.responseHeaderKeepAlive ) ;
        res.header['cache-control'].should.equal( FVT.responseHeaderCacheControl ) ;
        res.header['content-type'].should.equal( FVT.responseHeaderContentTypeJSON );

        var jsonResponse = JSON.parse( res.text );
    //    FVT.trace( 1, "PostFailureCallback ExpectedStatus:  "+ JSON.stringify(verifyMessage.status) + ' Actual Status: ' + res.statusCode + ' and MSG: ' + res.text[ 'Message'] );
        FVT.trace( 1, "PostFailureCallback ExpectedStatus:  "+ JSON.stringify(verifyMessage.status) + ' Actual Status: ' + res.statusCode + ' and MSG: ' + JSON.stringify(jsonResponse) );

        FVT.lastPost['stats'][ "status" ] = res.statusCode ;
        if  (verifyMessage.status) {
            res.statusCode.should.equal( verifyMessage.status )
            delete verifyMessage.status;
        } else {
            res.statusCode.should.equal(400);
        }

        verifyResponseTextParameter( jsonResponse);    
    }
    
    verifyMessage = '' ; verifyThis = '' ;
    done();
};

/*
 * Verify the response of a successful get request
 * USES:  Global Variable:  verifyThis
 */
FVT.getSuccessCallback = function(err, res, done) {
// 124463  this block can be removed once resolved.
    if ( err ) {
       FVT.trace( 0, "@getSuccessCallback and 'err object' was returned:" + JSON.stringify(err,1,1) );
       done = res;
       res = err;
    //   if ( typeof res == "object" ) {
    //       FVT.trace( 0, "@getSuccessCallback 'response object' that was returned:" + JSON.stringify(res,1,1) );
    //    } else {
    //        FVT.trace( 0, "@getSuccessCallback response that was returned:" + res );
    //    }
    } else {
       FVT.trace( 0, "@getSuccessCallback with response."  );
    }
var SAVE_DEBUG=FVT.DEBUG;
FVT.DEBUG=5;

//    var MS_RESTAPI_TYPE = false;
    // UGH! defect 217232 can not access res.req....
//    if ( res.req.url.search( "/ima/" ) >= 0 ) { FVT.MS_RESTAPI_TYPE = true ; }  // Both contain CONNECTION Objects and they are dis-similar
    
    if ( res.header['content-type'] == 'text/html;charset=utf-8' ) {  // about Endpoint
        FVT.trace( 0, "HTML not processed by getSuccessCallback, DUMP:"+ JSON.stringify(res, 1, 1) );

    } else if ( res.header['content-type'] == 'text/plain;charset=utf-8' ) {  // Plugin PropertiesFile response
//        console.log( "text= "+ res['text'] );
//        console.log( "verifyMessage= "+ verifyMessage );
        FVT.trace( 2, 'GetSuccessCallback (plain text) Response:  '+ JSON.stringify( res, null, 2) );
        res['text'].should.equal( verifyMessage );
        
    } else {
        FVT.trace( 1, 'Get StatusCode:  '+ res.statusCode);
        FVT.trace( 2, 'GetSuccessCallback Response:  '+ JSON.stringify( res, null, 2) );
        var jsonResponse = JSON.parse(res.text);
    // 102118 - Validate Header lines
        FVT.trace( 5, 'Content-length: '+ res.header['content-length'] + " .vs. response.text.length(): " + res.text.length);
    //    res.text.length.should.equal(  Number( res.header['content-length'] )  );
        res.header['server'].should.equal( FVT.responseHeaderProductName );
        res.header['access-control-allow-credentials'].should.equal( "true" );
        res.header['connection'].should.equal( FVT.responseHeaderConnection ) ;
        res.header['keep-alive'].should.equal( FVT.responseHeaderKeepAlive ) ;
        res.header['cache-control'].should.equal( FVT.responseHeaderCacheControl ) ;
        res.header['content-type'].should.equal( FVT.responseHeaderContentTypeJSON );

        // Check an HTTP return code
        res.statusCode.should.equal(200);
        
        FVT.trace( 1, "VERIFY THIS: "+ JSON.stringify(verifyThis, null, 2) );
        FVT.trace( 1, "IS IN CURRENT CONFIGURATION: "+JSON.stringify(jsonResponse, null, 2) );

        for (var key in verifyThis) {
            if (jsonResponse.hasOwnProperty( key )) {
                var val = verifyThis[key]; 
                FVT.trace( 4,"KEY: " + key + " HAS VALUE: " + JSON.stringify(val) +" WITH TYPEOF: "+ typeof val);
                if ( typeof val != "object" ) {
                    FVT.trace( 5,"Did KEY returned a jsonResponse with THAT Value?");
                    if ( jsonResponse[key] === val ) {
                        FVT.trace( 2, 'For: "'+ key +'" value '+jsonResponse[key] + ' EQUALS expected: ' + verifyThis[key]);
                    } else {
                        FVT.trace( 2, 'For: "'+ key +'" value ['+jsonResponse[key] + '] of type '+ typeof jsonResponse[key] +' DOES NOT EQUAL expected: [' + verifyThis[key] + '] of type: '+ typeof verifyThis[key] );
    //                    if ( MOCHA_STOP_FIRST_ERROR === true ) {
    //                        debugger;
    //                    } else {
                            verifyMessage = '' ; verifyThis = '' ;
                            throw new Error('For: "'+ key +'" value ['+jsonResponse[key] + '] DOES NOT EQUAL expected: [' + val + ']');
    //                    }
                    }
                } else {
                    FVT.trace( 5,"Is the KEY "+ key +" in jsonResponse?");
                    if (jsonResponse.hasOwnProperty( key )) {
                        FVT.trace( 4,'YES, the KEY is in expected results, more to come for FVT.MS_RESTAPI_TYPE:'+ FVT.MS_RESTAPI_TYPE);
                        if ( FVT.MS_RESTAPI_TYPE ) {
                            // MessageSight RESTAPI
                            if ( key === "TrustedCertificate" || key === "ClientCertificate" || key === "TopicMonitor" || key === "MQTTClient" || key === "Subscription" || key === "Connection" ) {
                                FVT.trace( 5, "Handle the ARRAY for: " + key );
                                verifyArray( val, jsonResponse[key] );
                            } else {
                                verifyFields( val, jsonResponse[key] );
                            }
                        } else {
                            // Bridge-Proxy RESTAPI
                                verifyFields( val, jsonResponse[key] );                        
                        }
                    } else {
                        FVT.trace( 4,'NO, the KEY is NOT in expected results, more to come or errexit really....');
                    }

                }
            } else {
                if ( verifyThis[key] == null ) {
                    FVT.trace( 2, 'For ('+ key +') value ['+verifyThis[key] + '] was correctly not found in the response.' );
                } else {
                    FVT.trace( 0, "jsonResponse did not have KEY:"+ key );
    //                if ( MOCHA_STOP_FIRST_ERROR === true ) {
    //                    debugger;
    //                } else {
                        verifyMessage = '' ; verifyThis = '' ;
                        throw new Error('Failed to validate:'+ res.req.url +' Response did not have KEY:'+ key) ;
    //                }
                }
            }
        }
        
        
    //    }
    //    catch (ex) {
    //       FVT.trace( 0, "Unexpected Exception: "+ ex );
    //       FVT.trace( 0,JSON.stringify(jsonPayload, null, 2));
    //    }
    }
FVT.DEBUG = SAVE_DEBUG;
    verifyMessage = '' ; verifyThis = '' ;
    done();
};

/*
 * Verify the response of a successful DELETE with a GET request that will NOT contain the deleted object
 */
FVT.getVerifyDeleteCallback = function(err, res, done) {
    // Check an HTTP return code
    FVT.trace( 2, 'getVerifyDeleteCallback Response:  '+ JSON.stringify( res, null, 2) );
// 102118 - Validate Header lines
    FVT.trace( 5, 'Content-length: '+ res.header['content-length'] + " .vs. response.text.length(): " + res.text.length);
//    res.text.length.should.equal(  Number( res.header['content-length'] )  );
    res.header['server'].should.equal( FVT.responseHeaderProductName );
    res.header['access-control-allow-credentials'].should.equal( "true" );
    res.header['connection'].should.equal( FVT.responseHeaderConnection ) ;
    res.header['keep-alive'].should.equal( FVT.responseHeaderKeepAlive ) ;
    res.header['cache-control'].should.equal( FVT.responseHeaderCacheControl ) ;
    res.header['content-type'].should.equal( FVT.responseHeaderContentTypeJSON );

    res.statusCode.should.equal(200);

    var jsonResponse = JSON.parse(res.text);
    
    FVT.trace( 1, "VERIFY THIS: "+ JSON.stringify(verifyThis, null, 2) );
    FVT.trace( 1, "IS NOT IN PAYLOAD: "+JSON.stringify(jsonResponse, null, 2) );

//    try {

        for ( var key in verifyThis ) {
        FVT.trace( 0 , 'key=' + key + ' and  Value ' + verifyThis[key] );
            if ( jsonResponse.hasOwnProperty( key )) {
                if( key === "TrustedCertificate" || key === "ClientCertificate" || key === "TopicMonitor" || key === "MQTTClient" ) {
                    FVT.trace( 0 , 'Special Process needed for Array elements in: ' + key +' : '+ JSON.stringify( verifyThis[key] )  );
                    //verifyArrayDelete();
                    expectArray     = verifyThis[key][0] ;
                    var expectCount = verifyThis[key].length + 1;
                    actualArray = jsonResponse[key] ;
                    for ( var i =0; i < actualArray.length; i++ ) {
                        FVT.trace( 0, "Array element #"+ i + " Actual value "+ JSON.stringify(actualArray[i]) +" .vs. Expected: "+ JSON.stringify( expectArray ) );
                        FVT.trace( 0, "Expected keys count: "+ expectCount + " .vs. Actual keys count: "+ (actualArray.length+1) );
                        var actualMatch = 0;
                        for ( var expectKey in expectArray ) {
                            FVT.trace( 5, "Is expectedKey, "+ expectKey +" in the actualArray?");
                            if (actualArray[i].hasOwnProperty( expectKey )) {
                                FVT.trace( 3, 'Expect value: '+ JSON.stringify( expectArray[expectKey] ) +' .vs. Actual value: '+ JSON.stringify( actualArray[i][expectKey] ) );
                                if ( expectArray[expectKey] === actualArray[i][expectKey] ) {
                                    actualMatch++;
                                    FVT.trace( 0, '"'+ expectKey +'":"'+ expectArray[expectKey] +'" matched, match count: '+ actualMatch );
                                } else {
                                    FVT.trace( 0,  expectArray[expectKey] +" NOT matched, try next Array Element" );
                                    break;
                                }
                            }
                        }
                        FVT.trace( 5, "Was this a match? ExpectedKeys: "+ expectCount +" Matched Keys: "+ actualMatch );
                        if ( actualMatch == expectCount ) {
                            FVT.trace( 0, 'Expected the array element. '+ JSON.stringify( expectArray ) +' to be deleted, but was NOT!' );
                            verifyMessage = '' ; verifyThis = '' ;
                            throw new Error('Expected the array element. '+ JSON.stringify( expectArray ) +' to be deleted, but was NOT!');
                        }
                    }
                    FVT.trace( 0, "Expected Array element was deleted.");
                // Process NON-Array elements
                } else {
                    var val = verifyThis[key];
                    FVT.trace( 1,"Expected KEY: " + key + " HAS VALUE: " + JSON.stringify(val) +" WITH TYPEOF: "+ typeof val);             // 4
                    var resVal = jsonResponse[key];
                    FVT.trace( 1,"Response KEY: " + key + " HAS VALUE: " + JSON.stringify(resVal) +" WITH TYPEOF: "+ typeof resVal);             // 4

                    for ( var objectName in val ) {
                        if ( resVal.hasOwnProperty( objectName )) {
                            FVT.trace( 0, "FAILED, object was NOT Deleted: "+objectName );  
    //                        if ( MOCHA_STOP_FIRST_ERROR === true ) {
    //                            debugger;
    //                        } else {
                                verifyMessage = '' ; verifyThis = '' ;
                                throw new Error('Expected the object. '+ objectName +' to be deleted, but was NOT!')
    //                        }
                        } else {
                            FVT.trace( 1, "VERIFY Deleted: "+ objectName );  
                                jsonResponse.should.not.have.property( objectName );
                                jsonResponse.should.have.property('Version');
                                jsonResponse.Version.should.equal( FVT.version );
                            
                        }
                    }
                }
            } else {
                if ( verifyThis[key] == null ) {
                    FVT.trace( 2, 'For ('+ key +') value ['+verifyThis[key] + '] was correctly not found in the response.' );
                } else {
                    FVT.trace( 0, "jsonResponse did not have KEY:"+ key );
//                    if ( MOCHA_STOP_FIRST_ERROR === true ) {
//                        debugger;
//                    } else {
                        verifyMessage = '' ; verifyThis = '' ;
                        throw new Error('Failed to validate:'+ "res.req.url" +' Response did not have KEY:'+ key) ;
//                    }
                }
            }
        }

//    } catch (ex) {
//       FVT.trace( 0, "Unexpected Exception: "+ ex );
//       FVT.trace( 0,JSON.stringify(jsonResponse, null, 2));
//    }

    verifyMessage = '' ; verifyThis = '' ;
    done();
};


/*
 * Verify the Delete with a Get who's response is 404 (Not Found)
 */
FVT.verify404NotFound = function(err, res, done) {
//    try {
        FVT.trace( 1, 'verify404NotFound StatusCode:  '+ res.statusCode);
        FVT.trace( 2, 'verify404NotFound Response:  '+ JSON.stringify( res, null, 2) );
        // 102118 - Validate Header lines
        FVT.trace( 5, 'Content-length: '+ res.header['content-length'] + " .vs. response.text.length(): " + res.text.length);
//        res.text.length.should.equal(  Number( res.header['content-length'] )  );
        res.header['server'].should.equal( FVT.responseHeaderProductName );
        res.header['access-control-allow-credentials'].should.equal( "true" );
        res.header['connection'].should.equal( FVT.responseHeaderConnection ) ;
        res.header['keep-alive'].should.equal( FVT.responseHeaderKeepAlive ) ;
        res.header['cache-control'].should.equal( FVT.responseHeaderCacheControl ) ;
        res.header['content-type'].should.equal( FVT.responseHeaderContentTypeJSON );

        FVT.trace( 1, "VerifyThis: Code="+ verifyThis['Code'] +" & Message="+ verifyThis['Message'] );
        // Check an HTTP return code
        if ( verifyThis['status'] == 'undefined' ) {
            res.statusCode.should.equal(404);
        } else if ( verifyThis['status'] === null ) {
            null;
        } else {
            if ( res.text.Version ) {
                // MessageSight RESTAPI
                res.statusCode.should.equal( verifyThis['status'] );
                res.text.Version.should.equal( FVT.version );
            } else {
                // Bridge-Proxy RESTAPI
                res.statusCode.should.equal(404);                
                res.text.should.not.have.property('Version');
            }
        }

        var jsonPayload = JSON.parse(res.text);

        if ( verifyThis['Message'] == 'undefined' ) {   // Support old user of Verify404 when only got 113 text
            jsonPayload.should.have.property('Message');
            jsonPayload.Message.should.equal('The requested item is not found.');
        } else if ( verifyThis['Message'] === null ) {
            null;
        } else {
            jsonPayload.should.have.property('Message');
            jsonPayload.Message.should.equal( verifyThis['Message'] );
        }

        if ( verifyThis['Code'] == 'undefined' ) {   // Support old user of Verify404 when only got 113
            jsonPayload.should.have.property('Code');
            jsonPayload.Code.should.equal('CWLNA0113');
        } else if ( verifyThis['Code'] === null ) {
            null;
        } else {
            jsonPayload.should.have.property('Code');
            jsonPayload.Code.should.equal( verifyThis['Code'] );
        }

        FVT.trace( 1, "Verified the 404 results successfully");
    
//    } catch (ex) {
//        FVT.trace( 0, "Unexpected Exception: "+ ex );
//        FVT.trace( 0,JSON.stringify(jsonPayload, null, 2));
//    }
    verifyMessage = '' ; verifyThis = '' ;
    done();
};

/*
 * Verify the response of a failed get request
 */
FVT.getFailureCallback = function(err, res, done) {
    response="";
    if( err != null ) {
        FVT.trace( 0, 'GetFailureCallback (err):  '+ err + ' of type: ' + typeof err );
        FVT.trace( 0, 'GetFailureCallback (err) Response:  '+ JSON.stringify( err, null, 2) );
        if( typeof err == 'string' ) {  // sometimes only two parameters are returned, sometime 3 and error is either a NULL or a STRING.
            response = res;
        } else {   // err was an OBJECT - most likely 'res' contains the DONE callback
            response = err;
            done = res;
        }
    } else {  // Callback parameters are as expected: err=null, res=Response Object, done=FinalCallback
        FVT.trace( 0, 'GetFailureCallback (err):  '+ err );
        FVT.trace( 0, 'GetFailureCallback Response:  '+ JSON.stringify( res, null, 2) );
        response = res;
    }
    
    // 102118 - Validate Header lines
    FVT.trace( 5, 'Content-length: '+ response.header['content-length'] + " .vs. response.text.length(): " + response.text.length);
    response.text.length.should.equal(  Number( response.header['content-length'] )  );
    response.header['server'].should.equal( FVT.responseHeaderProductName );
    response.header['access-control-allow-credentials'].should.equal( "true" );
    response.header['connection'].should.equal( FVT.responseHeaderConnection ) ;
    response.header['keep-alive'].should.equal( FVT.responseHeaderKeepAlive ) ;
    response.header['cache-control'].should.equal( FVT.responseHeaderCacheControl ) ;
    if ( response.header['content-type'] == FVT.responseHeaderContentTypePlain ) {
        // sucky problem with global vars when this fails...
//        var expectText = verifyThis; verifyMessage = '' ; verifyThis = '' ;
        response['text'].should.equal( verifyThis );
    } else {
        response.header['content-type'].should.equal( FVT.responseHeaderContentTypeJSON );

        //if (err) {
            // if ( typeof err == "string" ) {
                // response = res;
                // FVT.trace( 0, "@GetFailureCallback 'err' typeof string: "+ error +" The RESPONSE errorcode: "+ String(response.statusCode) );
            // } 
            // if ( typeof err == "object" ) {
               // if ( res ) {
                   // response = res;
               // } else {
                   // response = err;
               // }
               // FVT.trace( 0, "@GetFailureCallback 'err' typeof object:  "+ String(err) +": The ERROR errorcode: "+String(response.statusCode) );
            // } else {
                // response = res;
                // FVT.trace( 0, "@GetFailureCallback not sure what type 'err' is:  "+ String(err) +": Assume 'res' has errorcode:"+ String(response.statusCode) );
            // }
            FVT.trace( 0, "@GetFailureCallback EXPECTED errorcode:"+ verifyThis.status );
            if ( verifyThis.status == response.statusCode ) {
                FVT.trace( 2, 'The '+ verifyThis.status +' response was expected.' );
                delete verifyThis.status ;
                delete verifyMessage.status ;
                FVT.trace( 0, 'Deleted verifyMessage.status: '+ verifyMessage.status +' and verifyThis.status: '+ verifyThis.status );
            } else {
                FVT.trace( 3, "GetFailureCallback Unexpected ERROR:  "+ String(err) );
    //            if ( MOCHA_STOP_FIRST_ERROR === true ) {
    //                debugger;
    //            } else {
                    verifyMessage = '' ; verifyThis = '' ;
                    throw new Error(err);
    //            }
            }
        //}
        // FVT.trace( 2, "GetFailureCallback Response:  "+ String(response) );
        // FVT.trace( 5, "GetFailureCallback Response:  "+ JSON.stringify(response, null, 2) );

        // JSON pretty printing
        var jsonResponse = JSON.parse( response.text );
        verifyResponseTextParameter( jsonResponse );    
        // FVT.trace( 1, JSON.stringify( jsonResponse, null, 2 ) );
    }
    verifyMessage = '' ; verifyThis = '' ;
    done();
};

/*
 * Verify the response of a successful delete request
 */
FVT.deleteSuccessCallback = function(err, res, done) {
    if (err) {
        FVT.trace( 0, 'deleteSuccessCallback (err):  '+ err + ' of type: ' + typeof err );
        
    }
    FVT.trace( 2, 'DeleteSuccessCallback Response:  '+ JSON.stringify( res, null, 2) );
// 102118 - Validate Header lines
    FVT.trace( 5, 'Content-length: '+ res.header['content-length'] + " .vs. response.text.length(): " + res.text.length);
    res.text.length.should.equal(  Number( res.header['content-length'] )  );
    res.header['server'].should.equal( FVT.responseHeaderProductName );
    res.header['access-control-allow-credentials'].should.equal( "true" );
    res.header['connection'].should.equal( FVT.responseHeaderConnection ) ;
    res.header['keep-alive'].should.equal( FVT.responseHeaderKeepAlive ) ;
    res.header['cache-control'].should.equal( FVT.responseHeaderCacheControl ) ;
    res.header['content-type'].should.equal( FVT.responseHeaderContentTypeJSON );

    var jsonPayload = JSON.parse(res.text);

    FVT.trace( 1, 'Delete StatusCode:  '+ res.statusCode);
    FVT.trace( 1, 'Delete Message:  '+ jsonPayload.Message);
    FVT.trace( 1, 'Expected Response Message:  '+ verifyMessage.Message );
    
    if ( verifyMessage.Message === undefined ) {  // all old deletes should be fixed and pass Code and Message now, but just in case...
        res.statusCode.should.equal(200);
    } else {
        if ( verifyMessage.Status ) {
            // MessageSight response should have "Status" and "Version" elements in text
            res.statusCode.should.equal( verifyMessage.Status);
            jsonPayload.should.have.property('Version');
            jsonPayload.Version.should.equal( FVT.version );
        } else {
            // Proxy-Bridge response, use statusCode in the HTTP Response, NOT element in text NOR is Version
            res.statusCode.should.equal(200);
        }
        jsonPayload.should.have.property('Message');
        FVT.trace(1, "verify=" + verifyMessage.Message + " is=" + jsonPayload.Message)
        jsonPayload.Message.should.startWith( verifyMessage.Message );
        jsonPayload.should.have.property('Code');
        jsonPayload.Code.should.equal( verifyMessage.Code );
    }

    verifyMessage = '' ; verifyThis = '' ;
    done();
};

/*
 * Verify the response of a successful delete request
 */
FVT.putSuccessCallback = function(err, res, done) {
    if ( err ) {
        FVT.trace( 0, 'putSuccessCallback (err):  '+ err + ' of type: ' + typeof err );
        FVT.trace( 0, 'putSuccessCallback (err) Response:  '+ JSON.stringify( err, null, 2) );
        if( typeof err == 'string' ) {  // sometimes only two parameters are returned, sometime 3 and error is either a NULL or a STRING.
            response = res;
        } else {   // err was an OBJECT - most likely 'res' contains the DONE callback
            response = err;
            done = res;
        }

    } else {
        response = res;
    }
    FVT.trace( 3, 'PutSuccessCallback Response:  '+ JSON.stringify( response, null, 2) );
    
// 102118 - Validate Header lines
    FVT.trace( 5, 'Content-length: '+ response.header['content-length'] + " .vs. response.text.length(): " + response.text.length);
    response.text.length.should.equal(  Number( response.header['content-length'] )  );
    response.header['server'].should.equal( FVT.responseHeaderProductName );
    response.header['access-control-allow-credentials'].should.equal( "true" );
    response.header['connection'].should.equal( FVT.responseHeaderConnection ) ;
    response.header['keep-alive'].should.equal( FVT.responseHeaderKeepAlive ) ;
    response.header['cache-control'].should.equal( FVT.responseHeaderCacheControl ) ;
    response.header['content-type'].should.equal( FVT.responseHeaderContentTypeJSON );

    var jsonPayload = JSON.parse(response.text);
    
    jsonPayload.should.have.property('Version');
    jsonPayload.Version.should.equal( FVT.version );

    if ( verifyMessage.Message === undefined ) {
        response.statusCode.should.equal(200);
        jsonPayload.should.have.property('Message');
        jsonPayload.Message.should.equal('The requested configuration change has completed successfully.');
        jsonPayload.should.have.property('Code');
        jsonPayload.Code.should.equal('CWLNA6011');
    } else {
        response.statusCode.should.equal( verifyMessage.Status );
        jsonPayload.should.have.property('Message');
        jsonPayload.Message.should.equal( verifyMessage.Message );
        jsonPayload.should.have.property('Code');
        jsonPayload.Code.should.equal( verifyMessage.Message );
    }

    verifyMessage = '' ; verifyThis = '' ;
    done();
};


/*
 * Verify the response of a failed delete request
 *  Expects GLOBAL VerifyMessage set with KEYS:  Code, Message
 */
FVT.deleteFailureCallback = function(err, res, done) {
    FVT.trace( 0, 'DeleteFailureCallback Response:  '+ JSON.stringify( res, null, 2) );
// 102118 - Validate Header lines
    FVT.trace( 5, 'Content-length: '+ res.header['content-length'] + " .vs. response.text.length(): " + res.text.length);
    res.text.length.should.equal(  Number( res.header['content-length'] )  );
    res.header['server'].should.equal( FVT.responseHeaderProductName );
    res.header['access-control-allow-credentials'].should.equal( "true" );
    res.header['connection'].should.equal( FVT.responseHeaderConnection ) ;
    res.header['keep-alive'].should.equal( FVT.responseHeaderKeepAlive ) ;
    res.header['cache-control'].should.equal( FVT.responseHeaderCacheControl ) ;
    res.header['content-type'].should.equal( FVT.responseHeaderContentTypeJSON );

    FVT.trace( 1, 'Actual Delete StatusCode:  '+ res.statusCode);
    FVT.trace( 1, 'Expected Delete Response:  '+ JSON.stringify(verifyMessage));
    if  (verifyMessage.status) {
        res.statusCode.should.equal( verifyMessage.status );
//        delete verifyMessage.status;
    } else {
        res.statusCode.should.equal(400);
    }
    var jsonPayload = JSON.parse(res.text);
    FVT.trace( 1, 'Delete Message:  '+ jsonPayload.Message);
    
    if ( res.text.Version ) {
    //  ASSUME a MessageSight Response (Bridge does not have version)
        jsonPayload.should.have.property('Version');
        jsonPayload.Version.should.equal( FVT.version );
    }
    jsonPayload.should.have.property('Message');
    jsonPayload.Message.should.equal( verifyMessage.Message );
    jsonPayload.should.have.property('Code');
    jsonPayload.Code.should.equal( verifyMessage.Code );
console.log("Delete Validated");
    verifyMessage = '' ; verifyThis = '' ;
    done();
};

/*
 * Make a POST request when you expect the 'Cmd completed successfully' response
 */
FVT.makePostRequest = function( domain, payload, callback, expectedConfig, done ) {
    FVT.trace( 1, 'POST domain: '+ encodeURI(domain) +'  with payload: '+payload);
    FVT.trace( 0, 'ClientTime: '+ new Date() );
    verifyThis = expectedConfig;
    verifyMessage = '';
    FVT.trace( 1, 'Expected Config: '+ JSON.stringify(expectedConfig) );
    try {
        request(url)
          .post( encodeURI(domain) )
//          .set('Content-Type','application/json')
////          .write(JSON.stringify( '{ "username":"'+FVT.A1_REST_USER +'","password":"'+ FVT.A1_REST_PW +'" }' ))
//          .write(JSON.stringify( '{"username":"admin","password":"admin"}' ))
          .send(payload)
          .end(function(err, res) {
            if (err) {
                FVT.trace( 0, '=== ERROR in makePostRequest ===:' + String(err) );
                if (res) {
                    FVT.trace( 0, '== was a Response ==:' + JSON.stringify(res, null, 2));
                    callback( null, res, done );
                } else {
    //                if ( MOCHA_STOP_FIRST_ERROR === true ) {
    //                    debugger;
    //                } else {
                        verifyMessage = '' ; verifyThis = '' ;
                        throw new Error(err);
    //                }
                }
            } else {
                callback( err, res, done );
            }

        });
    } catch ( ex ) {
        FVT.trace( 0, "Unexpected Exception in makePostRequest: "+ ex.message);
        FVT.trace( 0, JSON.stringify(ex.message, null, 2));
        verifyMessage = '' ; verifyThis = '' ;
    }
};

FVT.makePostRequestWithAuth = function( thisURL, domain, auth, payload, callback, expectedConfig, done ) {
    if ( thisURL === null ){ thisURL = url ; }
    var splitAuth = auth.toString().split( "," );
    FVT.trace( 1, 'POST domain: '+ thisURL + encodeURI(domain) + " AUTH " + splitAuth[0] +" : "+ splitAuth[1]  +'  with payload: '+ payload);
    FVT.trace( 0, 'ClientTime: '+ new Date() );
    verifyThis = expectedConfig;
    verifyMessage = '';
    FVT.trace( 1, 'Expected Config: '+ JSON.stringify(expectedConfig) );
    try {
        request(thisURL)
          .post( encodeURI(domain) )
//          .set('Content-Type','application/json')
////          .write(JSON.stringify( '{ "username":"'+FVT.A1_REST_USER +'","password":"'+ FVT.A1_REST_PW +'" }' ))
//          .write(JSON.stringify( '{"username":"admin","password":"admin"}' ))
          .send(payload)
          .auth( splitAuth[0] , splitAuth[1] )
          .end(function(err, res) {
            if (err) {
                FVT.trace( 0, '=== ERROR in makePostRequestWithAuth ===:' + String(err) );
                if (res) {
                    FVT.trace( 0, '== was a Response ==:' + JSON.stringify(res, null, 2));
                    callback( null, res, done );
                } else {
    //                if ( MOCHA_STOP_FIRST_ERROR === true ) {
    //                    debugger;
    //                } else {
                        verifyMessage = '' ; verifyThis = '' ;
                        throw new Error(err);
    //                }
                }
            } else {
                callback( err, res, done );
            }

        });
    } catch ( ex ) {
        FVT.trace( 0, "Unexpected Exception in makePostRequestWithAuth: "+ ex.message);
        FVT.trace( 0, JSON.stringify(ex.message, null, 2));
        verifyMessage = '' ; verifyThis = '' ;
    }
};

FVT.makePostRequestWithURL = function( thisURL, domain, payload, callback, expectedConfig, done ) {
    FVT.trace( 1, 'POST domain: '+ thisURL + encodeURI(domain) +'  with payload: '+payload);
    FVT.trace( 0, 'ClientTime: '+ new Date() );
    verifyThis = expectedConfig;
    verifyMessage = '';
    FVT.trace( 1, 'Expected Config: '+ JSON.stringify(expectedConfig) );
    try {
        request(thisURL)
          .post( encodeURI(domain) )
          .send(payload)
          .end(function(err, res) {
            callback(err, res, done);
            if (err) {
                FVT.trace( 0, '=== ERROR in makePostRequestWithURL ===:' + String(err) );
                FVT.trace( 0, JSON.stringify(res, null, 2));
//                if ( MOCHA_STOP_FIRST_ERROR === true ) {
//                    debugger;
//                } else {
                    verifyMessage = '' ; verifyThis = '' ;
                    throw new Error(err);
//                }
            }
        });
    } catch ( ex ) {
        FVT.trace( 0, "Unexpected Exception in makePostRequestWithURL: "+ ex.message);
        FVT.trace( 0, JSON.stringify(ex.message, null, 2));
        verifyMessage = '' ; verifyThis = '' ;
    }
};

/*
 * Make a POST request with Verify Parameters
 */
FVT.makePostRequestWithVerify = function( domain, payload, callback, expectedConfig, expectedMessage, done ) {
    FVT.trace( 1, 'POST domain: '+ encodeURI(domain) +'  with payload: '+payload);
    FVT.trace( 0, 'ClientTime: '+ new Date() );
    verifyThis = expectedConfig;
    FVT.trace( 1, 'Expected Config: '+ JSON.stringify(expectedConfig) );
    verifyMessage = expectedMessage;
    FVT.trace( 1, 'Expected Message: '+ JSON.stringify(expectedMessage) );
    
    try {
        request(url)
          .post( encodeURI(domain) )
          .send(payload)
          .end(function(err, res) {
            if (err) {
                FVT.trace( 0, '=== ERROR in makePostRequestWithVerify ===:' + String(err) );
                if (res) {
                    FVT.trace( 0, '== was a Response ==:' + JSON.stringify(res, null, 2));
                    callback( null, res, done );
                } else {
    //                if ( MOCHA_STOP_FIRST_ERROR === true ) {
    //                    debugger;
    //                } else {
                        verifyMessage = '' ; verifyThis = '' ;
                        throw new Error(err);
    //                }
                }
            } else {
                callback( err, res, done );
            }
            verifyMessage = '' ; verifyThis = '' ;
        });
    } catch ( ex ) {
        verifyMessage = '' ; verifyThis = '' ;
        FVT.trace( 0, "Unexpected Exception caught in makePostRequestWithVerify: "+ ex.message);
        FVT.trace( 0, JSON.stringify(ex.message, null, 2));
    }
};

/*
 * Make a POST request with Verify Parameters
 * REMEMBER expectedConfig and expectedMessage are JSON OBJECTS, 'NOT Strings' - get Undefined in Callback for verifyMessage if passed as string
 */
FVT.makePostRequestWithAuthVerify = function( thisURL, domain, auth, payload, callback, expectedConfig, expectedMessage, done ) {
    if ( thisURL === null ){ thisURL = url ; }
    var splitAuth = auth.toString().split( "," );
    FVT.trace( 1, 'POST domain: '+ thisURL + encodeURI(domain) + " AUTH " + splitAuth[0] +" : "+ splitAuth[1]  +'  with payload: '+ payload);
    FVT.trace( 0, 'ClientTime: '+ new Date() );
    verifyThis = expectedConfig;
    FVT.trace( 1, 'Expected Config: '+ JSON.stringify(expectedConfig) );
    verifyMessage = expectedMessage;
    FVT.trace( 1, 'Expected Message: '+ JSON.stringify(expectedMessage) );
    
    try {
        request(thisURL)
          .post( encodeURI(domain) )
          .send(payload)
          .auth( splitAuth[0] , splitAuth[1] )
          .end(function(err, res) {
            if (err) {
                FVT.trace( 0, '=== ERROR in makePostRequestWithAuthVerify ===:' + String(err) );
                if (res) {
                    FVT.trace( 0, '== was a Response ==:' + JSON.stringify(res, null, 2));
                    callback( null, res, done );
                } else {
    //                if ( MOCHA_STOP_FIRST_ERROR === true ) {
    //                    debugger;
    //                } else {
                        verifyMessage = '' ; verifyThis = '' ;
                        throw new Error(err);
    //                }
                }
            } else {
                FVT.trace( 5, "@CALLBACK in makePostRequestWithAuthVerify: "+  JSON.stringify(verifyMessage));
                callback( err, res, done );
            }
            verifyMessage = '' ; verifyThis = '' ;
        });
    } catch ( ex ) {
        verifyMessage = '' ; verifyThis = '' ;
        FVT.trace( 0, "Unexpected Exception caught in makePostRequestWithAuthVerify: "+ ex.message);
        FVT.trace( 0, JSON.stringify(ex.message, null, 2));
    }
};

/*
 * Make a POST request with Verify Parameters
 */
FVT.makePostRequestWithURLVerify = function( thisURL, domain, payload, callback, expectedConfig, expectedMessage, done ) {
    FVT.trace( 1, 'POST domain: '+ encodeURI(domain) +'  with payload: '+payload);
    FVT.trace( 0, 'ClientTime: '+ new Date() );
    verifyThis = expectedConfig;
    FVT.trace( 1, 'Expected Config: '+ JSON.stringify(expectedConfig) );
    verifyMessage = expectedMessage;
    FVT.trace( 1, 'Expected Message: '+ JSON.stringify(expectedMessage) );
    
    try {
        request( thisURL )
          .post( encodeURI(domain) )
          .send(payload)
          .end(function(err, res) {
            if (err) {
                FVT.trace( 0, '=== ERROR in makePostRequestWithURLVerify ===:' + String(err) );
                if (res) {
                    FVT.trace( 0, '== was a Response ==:' + JSON.stringify(res, null, 2));
                    callback( null, res, done );
                } else {
    //                if ( MOCHA_STOP_FIRST_ERROR === true ) {
    //                    debugger;
    //                } else {
                        verifyMessage = '' ; verifyThis = '' ;
                        throw new Error(err);
    //                }
                }
            } else {
                callback( err, res, done );
            }
            verifyMessage = '' ; verifyThis = '' ;

        });
    } catch ( ex ) {
        verifyMessage = '' ; verifyThis = '' ;
        FVT.trace( 0, "Unexpected Exception caught in makePostRequestWithURLVerify: "+ ex.message);
        FVT.trace( 0, JSON.stringify(ex.message, null, 2));
    }
};

// Numeric Server states can be found in server_admin/admin.h   @[ism_ServerState_t;]
// Design: Task 113866: How Angel will do the v1.2 Device RESET command in the RPM and Docker Environment
// basically:  curl -X POST http://<server:port>/ima/v1/ervice/restart -d '{ "Service":"Server","Reset":"config" }'
FVT.expectClusterDefault = '{"Cluster": { "Status": "Inactive", "Enabled":false }, "Version": "'+ FVT.version +'"}' ; 
FVT.expectHighAvailabilityDefault = '{ "HighAvailability": {"Status": "Inactive", "Enabled": false}, "Version": "'+ FVT.version +'"}' ; 
FVT.expectMQConnectivityDefault = '{ "MQConnectivity": { "Status": "Inactive", "Enabled":false },  "Version": "'+ FVT.version +'"}' ; 
FVT.expectPluginDefault = '{ "Plugin": { "Status": "Inactive", "Enabled":false }, "Version": "'+ FVT.version +'"}' ; 
FVT.expectSNMPDefault = '{"SNMP": { "Status": "Inactive", "Enabled":false }, "Version": "'+ FVT.version +'"}' ; 
FVT.expectServerDefault = '{"Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running"}, \
     "Version": "'+ FVT.version +'"}' ; 
FVT.expectServerMaintenanceLicense = '{"Server": {"ErrorCode": 387,"ErrorMessage": "${IMA_PRODUCTNAME_FULL} is not fully functional until you accept the license agreement using ${IMA_PRODUCTNAME_FULL} REST API.", \
     "State": 9, "StateDescription": "Running (maintenance)", "Status":"Running"}, \
     "Version": "'+ FVT.version +'"}'

FVT.expectClusterRunning = '{"Cluster": { "Status": "Active", "Enabled":true }, "Version": "'+ FVT.version +'"}' ; 
FVT.expectHighAvailabilityRunning = '{ "HighAvailability": {"Status": "Active", "Enabled": true}, "Version": "'+ FVT.version +'"}' ; 
FVT.expectMQConnectivityRunning = '{ "MQConnectivity": { "Status": "Active", "Enabled":true  },  "Version": "'+ FVT.version +'"}' ; 
FVT.expectPluginRunning = '{ "Plugin": { "Status": "Active", "Enabled":true  }, "Version": "'+ FVT.version +'"}' ; 
FVT.expectSNMPRunning = '{"SNMP": { "Status": "Active", "Enabled":true  }, "Version": "'+ FVT.version +'"}' ; 

FVT.expectPluginUninstalled = '{ "Plugin": { "Status": "Active", "Enabled":false  }, "Version": "'+ FVT.version +'"}' ; 

FVT.expectClusterStopped = '{"Cluster": { "Status": "Inactive", "Enabled":true }, "Version": "'+ FVT.version +'"}' ; 
FVT.expectHighAvailabilityStopped = '{ "HighAvailability": {"Status": "Inactive", "Enabled": true}, "Version": "'+ FVT.version +'"}' ; 
FVT.expectMQConnectivityStopped = '{ "MQConnectivity": { "Status": "Inactive", "Enabled":true },  "Version": "'+ FVT.version +'"}' ; 
FVT.expectPluginStopped = '{ "Plugin": { "Status": "Inactive", "Enabled":true }, "Version": "'+ FVT.version +'"}' ; 
FVT.expectSNMPStopped = '{"SNMP": { "Status": "Inactive", "Enabled":true }, "Version": "'+ FVT.version +'"}' ; 

     
if ( FVT.A1_TYPE == "DOCKER" ) {
    FVT.expectDefaultStatus = '{"Cluster": { "Status": "Inactive", "Enabled":false  }, \
     "Container": {}, \
     "HighAvailability": {"Status": "Inactive", "Enabled": false}, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running"}, \
     "Version": "'+ FVT.version +'"}' ; 
// should HA NODES be zero for this and have HAUNSYNC with one node?
    FVT.expectHARunningStatus = '{"Cluster": { "Status": "Inactive", "Enabled":false  }, \
     "Container": {}, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair", "ActiveNodes":1, "SyncNodes":1, "PctSyncCompletion": -1, "ReasonCode": 0, "RemoteServerName": "" }, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running"}, \
     "Version": "'+ FVT.version +'"}' ; 
// Reset:Config looses HA.AllowSingleNIC in server.cfg
    FVT.expectHAFailedNICsStatus = '{"Cluster": { "Status": "Initializing", "Enabled": true, "Name": "'+ FVT.MQKEY +'", "ConnectedServers": 0, "DisconnectedServers": 0 }, \
     "Container": {}, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair", "ActiveNodes":0, "SyncNodes":0, "PctSyncCompletion": -1, "ReasonCode": 0, "RemoteServerName": "" }, \
     "MQConnectivity": { "Status": "Active", "Enabled":true  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Active", "Enabled":true  }, \
     "Server": {"ErrorCode": 510,"ErrorMessage": "An HA configuration parameter is not valid: parameter name=HA.LocalDiscoveryNIC value='+ FVT.A1_IPv4_HA0 +'.","State": 9,"StateDescription": "Running (maintenance)", "Status":"Running" }, \
     "Version": "'+ FVT.version +'"}' ; 

    FVT.expectHARunningA1Unsync = '{"Cluster": { "Status": "Inactive", "Enabled":false  }, \
     "Container": {}, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair", "ActiveNodes":1, "SyncNodes":1, "PctSyncCompletion": -1, "ReasonCode": 0, "RemoteServerName": "" }, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running"}, \
     "Version": "'+ FVT.version +'"}' ; 

    FVT.expectHARunningA1Sync = '{"Cluster": { "Status": "Inactive", "Enabled":false  }, \
     "Container": {}, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair", "ActiveNodes":2, "SyncNodes":2, "PctSyncCompletion": -1, "ReasonCode": 0, "RemoteServerName": "'+ FVT.A2_SERVERNAME +':'+ FVT.A2_PORT +'" }, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running"}, \
     "Version": "'+ FVT.version +'"}' ; 

    FVT.expectHARunningA2UnSync = '{"Cluster": { "Status": "Inactive", "Enabled":false  }, \
     "Container": {}, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair", "NewRole":"UNSYNC", "ActiveNodes":0, "SyncNodes":0, "PctSyncCompletion": -1, "ReasonCode": 0, "RemoteServerName": "", "PrimaryLastTime":"" }, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 510,"ErrorMessage": "","State": 10,"StateDescription": "Standby", "Status":"Running"}, \
     "Version": "'+ FVT.version +'"}' ; 

    FVT.expectHARunningA2Sync = '{"Cluster": { "Status": "Inactive", "Enabled":false  }, \
     "Container": {}, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair", "NewRole":"STANDBY", "ActiveNodes":2, "SyncNodes":2, "PctSyncCompletion": -1, "ReasonCode": 0, "RemoteServerName": "'+ FVT.A1_SERVERNAME +':'+ FVT.A1_PORT +'" }, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 10,"StateDescription": "Standby", "Status":"Running"}, \
     "Version": "'+ FVT.version +'"}' ; 

    FVT.expectHARunningA1A2Sync = '{"Cluster": { "Status": "Inactive", "Enabled":false  }, \
     "Container": {}, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair12", "NewRole":"STANDBY", "ActiveNodes":2, "SyncNodes":2, "PctSyncCompletion": -1, "ReasonCode": 0, "RemoteServerName": "'+ FVT.A1_HOSTNAME_OS_SHORT +':'+ FVT.A1_PORT +'" }, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 10,"StateDescription": "Standby", "Status":"Running"}, \
     "Version": "'+ FVT.version +'"}' ; 

    FVT.expectHARunningA2A1Sync = '{"Cluster": { "Status": "Inactive", "Enabled":false  }, \
     "Container": {}, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair12", "NewRole":"STANDBY", "ActiveNodes":2, "SyncNodes":2, "PctSyncCompletion": -1, "ReasonCode": 0, "RemoteServerName": "'+ FVT.A2_HOSTNAME_OS_SHORT +':'+ FVT.A2_PORT +'" }, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 10,"StateDescription": "Standby", "Status":"Running"}, \
     "Version": "'+ FVT.version +'"}' ; 

    FVT.expectHARunningA3A4Sync = '{"Cluster": { "Status": "Inactive", "Enabled":false  }, \
     "Container": {}, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair34", "NewRole":"STANDBY", "ActiveNodes":2, "SyncNodes":2, "PctSyncCompletion": -1, "ReasonCode": 0, "RemoteServerName": "'+ FVT.A3_HOSTNAME_OS_SHORT +':'+ FVT.A3_PORT +'" }, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 10,"StateDescription": "Standby", "Status":"Running"}, \
     "Version": "'+ FVT.version +'"}' ; 

    FVT.expectHARunningA4A3Sync = '{"Cluster": { "Status": "Inactive", "Enabled":false  }, \
     "Container": {}, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair34", "NewRole":"STANDBY", "ActiveNodes":2, "SyncNodes":2, "PctSyncCompletion": -1, "ReasonCode": 0, "RemoteServerName": "'+ FVT.A4_HOSTNAME_OS_SHORT +':'+ FVT.A4_PORT +'" }, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 10,"StateDescription": "Standby", "Status":"Running"}, \
     "Version": "'+ FVT.version +'"}' ; 

     FVT.expectMQRunningStatus = '{"Cluster": { "Status": "Inactive", "Enabled":false  }, \
     "Container": {}, \
     "HighAvailability": {"Status": "Inactive", "Enabled": false}, \
     "MQConnectivity": { "Status": "Active", "Enabled":true  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running"}, \
     "Version": "'+ FVT.version +'"}' ; 
     
     if ( FVT.A_COUNT === '1' ) {
    // cluster of 1
         FVT.expectClusterConfigedStatus = '{"Cluster": { "Status": "Active", "Enabled":true, "ConnectedServers": 0, "DisconnectedServers": 0 }, \
         "Container": {}, \
         "HighAvailability": {"Status": "Inactive", "Enabled": false}, \
         "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
         "Plugin": { "Status": "Inactive", "Enabled":false  }, \
         "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running"}, \
         "SNMP": { "Status": "Inactive", "Enabled":false  }, \
         "Version": "'+ FVT.version +'"}' ;

         FVT.expectAllConfigedStatus = '{"Cluster": { "Status": "Active", "Enabled":true, "ConnectedServers": 0, "DisconnectedServers": 0, "Name":"'+ FVT.MQKEY +'" }, \
         "Container": {}, \
         "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair" }, \
         "MQConnectivity": { "Status": "Active", "Enabled":true  }, \
         "Plugin": { "Status": "Inactive", "Enabled":false  }, \
         "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running"}, \
         "SNMP": { "Status": "Active", "Enabled":true  }, \
         "Version": "'+ FVT.version +'"}' ; 

         FVT.expectAllConfigedSyncedStatus = '{"Cluster": { "Status": "Active", "Enabled":true, "ConnectedServers": 0, "DisconnectedServers": 0, "Name":"'+ FVT.MQKEY +'"  }, \
         "Container": {}, \
         "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair" }, \
         "MQConnectivity": { "Status": "Active", "Enabled":true  }, \
         "Plugin": { "Status": "Inactive", "Enabled":false  }, \
         "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running"}, \
         "SNMP": { "Status": "Active", "Enabled":true  }, \
         "Version": "'+ FVT.version +'"}' ; 
     
    } else {     
    // cluster of 2
         FVT.expectClusterConfigedStatus = '{"Cluster": { "Status": "Active", "Enabled":true, "ConnectedServers": 1, "DisconnectedServers": 0 }, \
         "Container": {}, \
         "HighAvailability": {"Status": "Inactive", "Enabled": false}, \
         "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
         "Plugin": { "Status": "Inactive", "Enabled":false  }, \
         "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running"}, \
         "SNMP": { "Status": "Inactive", "Enabled":false  }, \
         "Version": "'+ FVT.version +'"}' ; 

         FVT.expectAllConfigedStatus = '{"Cluster": { "Status": "Active", "Enabled":true, "ConnectedServers": 0, "DisconnectedServers": 0, "Name":"'+ FVT.MQKEY +'"  }, \
         "Container": {}, \
         "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair" }, \
         "MQConnectivity": { "Status": "Active", "Enabled":true  }, \
         "Plugin": { "Status": "Inactive", "Enabled":false  }, \
         "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running"}, \
         "SNMP": { "Status": "Active", "Enabled":true  }, \
         "Version": "'+ FVT.version +'"}' ; 

         FVT.expectAllConfigedSyncedStatus = '{"Cluster": { "Status": "Active", "Enabled":true, "ConnectedServers": 1, "DisconnectedServers": 0, "Name":"'+ FVT.MQKEY +'"  }, \
         "Container": {}, \
         "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair" }, \
         "MQConnectivity": { "Status": "Active", "Enabled":true  }, \
         "Plugin": { "Status": "Inactive", "Enabled":false  }, \
         "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running"}, \
         "SNMP": { "Status": "Active", "Enabled":true  }, \
         "Version": "'+ FVT.version +'"}' ; 
     
     }

    FVT.expectMaintenance = '{"Cluster": {"Status": "Inactive", "Enabled": false}, \
     "Container": {}, \
     "HighAvailability": {"Status": "Inactive", "Enabled": false}, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 9,"StateDescription": "Running (maintenance)"}, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Version": "'+ FVT.version +'"}' ;  

    FVT.expectMaintenanceWithCluster = '{"Cluster": {"Status": "Initializing", "Enabled": true}, \
     "Container": {}, \
     "HighAvailability": {"Status": "Inactive", "Enabled": false}, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 9,"StateDescription": "Running (maintenance)"}, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Version": "'+ FVT.version +'"}' ;  

    FVT.expectMaintenanceWithServices = '{"Cluster": {"Status": "Inactive", "Enabled": true}, \
     "Container": {}, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair", "NewRole":"UNKNOWN", "ActiveNodes":0, "SyncNodes":0, "PctSyncCompletion": 0, "ReasonCode": 0, "RemoteServerName": "" },  \
     "MQConnectivity": { "Status": "Active", "Enabled":true  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 145,"ErrorMessage": "The ${IMA_SVR_COMPONENT_NAME_FULL} must be restarted to complete the configuration changes.","State": 9,"StateDescription": "Running (maintenance)"}, \
     "SNMP": { "Status": "Active", "Enabled":true  }, \
     "Version": "'+ FVT.version +'"}' ;  
     
// {"Import":{ "DisableObject":true }} expected results
    FVT.expectMaintenanceWithDisableObjects = '{"Cluster": {"Status": "Inactive", "Enabled": false}, \
     "Container": {}, \
     "HighAvailability": {"Status": "Inactive", "Enabled": false },  \
     "MQConnectivity": { "Status": "Active", "Enabled":true  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 145,"ErrorMessage": "The ${IMA_SVR_COMPONENT_NAME_FULL} must be restarted to complete the configuration changes.","State": 9,"StateDescription": "Running (maintenance)"}, \
     "SNMP": { "Status": "Active", "Enabled":true  }, \
     "Version": "'+ FVT.version +'"}' ;  
     
} else {  // RPM Install (NOT Docker)
    FVT.expectDefaultStatus = '{"Cluster": { "Status": "Inactive", "Enabled": false }, \
     "HighAvailability": {"Status": "Inactive", "Enabled": false}, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running" }, \
     "Version": "'+ FVT.version +'"}' ; 
//  HA Configed yet not restarted - do I need another with O NODES and this is unSynced?
    FVT.expectHARunningStatus = '{"Cluster": { "Status": "Inactive", "Enabled": false }, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair", "ActiveNodes":1, "SyncNodes":1, "PctSyncCompletion": -1, "ReasonCode": 0, "RemoteServerName": "" }, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running" }, \
     "Version": "'+ FVT.version +'"}' ; 

    FVT.expectHAFailedNICsStatus = '{"Cluster": { "Status": "Initializing", "Enabled": true, "Name": "'+ FVT.MQKEY +'", "ConnectedServers": 0, "DisconnectedServers": 0 }, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair", "ActiveNodes":0, "SyncNodes":0, "PctSyncCompletion": -1, "ReasonCode": 0, "RemoteServerName": "" }, \
     "MQConnectivity": { "Status": "Active", "Enabled":true  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Active", "Enabled":true  }, \
     "Server": {"ErrorCode": 510,"ErrorMessage": "An HA configuration parameter is not valid: parameter name=HA.LocalDiscoveryNIC value='+ FVT.A1_IPv4_HA0 +'.","State": 9,"StateDescription": "Running (maintenance)", "Status":"Running" }, \
     "Version": "'+ FVT.version +'"}' ; 

    FVT.expectHARunningA1Unsync = '{"Cluster": { "Status": "Inactive", "Enabled": false }, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair", "ActiveNodes":1, "SyncNodes":1, "PctSyncCompletion": -1, "ReasonCode": 0, "RemoteServerName": "" }, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running" }, \
     "Version": "'+ FVT.version +'"}' ; 

    FVT.expectHARunningA1Sync = '{"Cluster": { "Status": "Inactive", "Enabled":false  }, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair", "ActiveNodes":2, "SyncNodes":2, "PctSyncCompletion": -1, "ReasonCode": 0, "RemoteServerName": "'+ FVT.A2_SERVERNAME +':'+ FVT.A2_PORT +'" }, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running"}, \
     "Version": "'+ FVT.version +'"}' ; 

    FVT.expectHARunningA2UnSync = '{"Cluster": { "Status": "Inactive", "Enabled":false  }, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair", "NewRole":"UNSYNC", "ActiveNodes":0, "SyncNodes":0, "PctSyncCompletion": -1, "ReasonCode": 0, "RemoteServerName": "", "PrimaryLastTime":"" }, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 10,"StateDescription": "Standby", "Status":"Running"}, \
     "Version": "'+ FVT.version +'"}' ; 

    FVT.expectHARunningA2Sync = '{"Cluster": { "Status": "Inactive", "Enabled":false  }, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair", "NewRole":"STANDBY", "ActiveNodes":2, "SyncNodes":2, "PctSyncCompletion": -1, "ReasonCode": 0, "RemoteServerName": "'+ FVT.A1_SERVERNAME +':'+ FVT.A1_PORT +'" }, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 10,"StateDescription": "Standby", "Status":"Running"}, \
     "Version": "'+ FVT.version +'"}' ; 

    FVT.expectHARunningA1A2Sync = '{"Cluster": { "Status": "Inactive", "Enabled":false  }, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair12", "NewRole":"STANDBY", "ActiveNodes":2, "SyncNodes":2, "PctSyncCompletion": -1, "ReasonCode": 0, "RemoteServerName": "'+ FVT.A1_HOSTNAME_OS_SHORT +':'+ FVT.A1_PORT +'" }, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 10,"StateDescription": "Standby", "Status":"Running"}, \
     "Version": "'+ FVT.version +'"}' ; 

    FVT.expectHARunningA2A1Sync = '{"Cluster": { "Status": "Inactive", "Enabled":false  }, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair12", "NewRole":"STANDBY", "ActiveNodes":2, "SyncNodes":2, "PctSyncCompletion": -1, "ReasonCode": 0, "RemoteServerName": "'+ FVT.A2_HOSTNAME_OS_SHORT +':'+ FVT.A2_PORT +'" }, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 10,"StateDescription": "Standby", "Status":"Running"}, \
     "Version": "'+ FVT.version +'"}' ; 

    FVT.expectHARunningA3A4Sync = '{"Cluster": { "Status": "Inactive", "Enabled":false  }, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair34", "NewRole":"STANDBY", "ActiveNodes":2, "SyncNodes":2, "PctSyncCompletion": -1, "ReasonCode": 0, "RemoteServerName": "'+ FVT.A3_HOSTNAME_OS_SHORT +':'+ FVT.A3_PORT +'" }, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 10,"StateDescription": "Standby", "Status":"Running"}, \
     "Version": "'+ FVT.version +'"}' ; 

    FVT.expectHARunningA4A3Sync = '{"Cluster": { "Status": "Inactive", "Enabled":false  }, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair34", "NewRole":"STANDBY", "ActiveNodes":2, "SyncNodes":2, "PctSyncCompletion": -1, "ReasonCode": 0, "RemoteServerName": "'+ FVT.A4_HOSTNAME_OS_SHORT +':'+ FVT.A4_PORT +'" }, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 10,"StateDescription": "Standby", "Status":"Running"}, \
     "Version": "'+ FVT.version +'"}' ; 

    FVT.expectMQRunningStatus = '{"Cluster": { "Status": "Inactive", "Enabled": false }, \
     "HighAvailability": {"Status": "Inactive", "Enabled": false}, \
     "MQConnectivity": { "Status": "Active", "Enabled":true }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running" }, \
     "Version": "'+ FVT.version +'"}' ; 
     
     if ( FVT.A_COUNT === '1' ) {
    // cluster of 1
         FVT.expectClusterConfigedStatus = '{"Cluster": { "Status": "Active", "Enabled":true, "ConnectedServers": 0, "DisconnectedServers": 0 }, \
         "HighAvailability": {"Status": "Inactive", "Enabled": false}, \
         "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
         "Plugin": { "Status": "Inactive", "Enabled":false  }, \
         "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running" }, \
         "SNMP": { "Status": "Inactive", "Enabled":false  }, \
         "Version": "'+ FVT.version +'"}' ;

         FVT.expectAllConfigedStatus = '{"Cluster": { "Status": "Active", "Enabled":true, "ConnectedServers": 0, "DisconnectedServers": 0, "Name":"'+ FVT.MQKEY +'" }, \
         "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair" }, \
         "MQConnectivity": { "Status": "Active", "Enabled":true  }, \
         "Plugin": { "Status": "Inactive", "Enabled":false  }, \
         "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running" }, \
         "SNMP": { "Status": "Active", "Enabled":true  }, \
         "Version": "'+ FVT.version +'"}' ; 

         FVT.expectAllConfigedSyncedStatus = '{"Cluster": { "Status": "Active", "Enabled":true, "ConnectedServers": 0, "DisconnectedServers": 0, "Name":"'+ FVT.MQKEY +'" }, \
         "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair" }, \
         "MQConnectivity": { "Status": "Active", "Enabled":true  }, \
         "Plugin": { "Status": "Inactive", "Enabled":false  }, \
         "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running" }, \
         "SNMP": { "Status": "Active", "Enabled":true  }, \
         "Version": "'+ FVT.version +'"}' ; 
     
    } else {     
    // cluster of 2
         FVT.expectClusterConfigedStatus = '{"Cluster": { "Status": "Active", "Enabled":true, "ConnectedServers": 1, "DisconnectedServers": 0 }, \
         "HighAvailability": {"Status": "Inactive", "Enabled": false}, \
         "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
         "Plugin": { "Status": "Inactive", "Enabled":false  }, \
         "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running" }, \
         "SNMP": { "Status": "Inactive", "Enabled":false  }, \
         "Version": "'+ FVT.version +'"}' ; 

         FVT.expectAllConfigedStatus = '{"Cluster": { "Status": "Active", "Enabled":true, "ConnectedServers": 0, "DisconnectedServers": 0, "Name":"'+ FVT.MQKEY +'" }, \
         "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair" }, \
         "MQConnectivity": { "Status": "Active", "Enabled":true  }, \
         "Plugin": { "Status": "Inactive", "Enabled":false  }, \
         "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running" }, \
         "SNMP": { "Status": "Active", "Enabled":true  }, \
         "Version": "'+ FVT.version +'"}' ; 

         FVT.expectAllConfigedSyncedStatus = '{"Cluster": { "Status": "Active", "Enabled":true, "ConnectedServers": 1, "DisconnectedServers": 0, "Name":"'+ FVT.MQKEY +'"   }, \
         "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair" }, \
         "MQConnectivity": { "Status": "Active", "Enabled":true  }, \
         "Plugin": { "Status": "Inactive", "Enabled":false  }, \
         "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running" }, \
         "SNMP": { "Status": "Active", "Enabled":true  }, \
         "Version": "'+ FVT.version +'"}' ; 
     
     }

    FVT.expectMaintenance = '{"Cluster": {"Status": "Inactive", "Enabled": false}, \
     "HighAvailability": {"Status": "Inactive", "Enabled": false}, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 9,"StateDescription": "Running (maintenance)"}, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Version": "'+ FVT.version +'"}' ;  

    FVT.expectMaintenanceWithCluster = '{"Cluster": {"Status": "Initializing", "Enabled": true}, \
     "HighAvailability": {"Status": "Inactive", "Enabled": false}, \
     "MQConnectivity": { "Status": "Inactive", "Enabled":false  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 0,"ErrorMessage": "","State": 9,"StateDescription": "Running (maintenance)"}, \
     "SNMP": { "Status": "Inactive", "Enabled":false  }, \
     "Version": "'+ FVT.version +'"}' ;  

    FVT.expectMaintenanceWithServices = '{"Cluster": {"Status": "Inactive", "Enabled": true}, \
     "HighAvailability": {"Status": "Active", "Enabled": true, "Group":"FVT_HAPair", "NewRole":"UNKNOWN", "ActiveNodes":0, "SyncNodes":0, "PctSyncCompletion": 0, "ReasonCode": 0, "RemoteServerName": "" },  \
     "MQConnectivity": { "Status": "Active", "Enabled":true  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 145,"ErrorMessage": "The ${IMA_SVR_COMPONENT_NAME_FULL} must be restarted to complete the configuration changes.","State": 9,"StateDescription": "Running (maintenance)"}, \
     "SNMP": { "Status": "Active", "Enabled":true  }, \
     "Version": "'+ FVT.version +'"}' ;  
     
// {"Import":{ "DisableObject":true }} expected results
    FVT.expectMaintenanceWithDisableObjects = '{"Cluster": {"Status": "Inactive", "Enabled": false}, \
     "HighAvailability": {"Status": "Inactive", "Enabled": false },  \
     "MQConnectivity": { "Status": "Active", "Enabled":true  }, \
     "Plugin": { "Status": "Inactive", "Enabled":false  }, \
     "Server": {"ErrorCode": 145,"ErrorMessage": "The ${IMA_SVR_COMPONENT_NAME_FULL} must be restarted to complete the configuration changes.","State": 9,"StateDescription": "Running (maintenance)"}, \
     "SNMP": { "Status": "Active", "Enabled":true  }, \
     "Version": "'+ FVT.version +'"}' ;  
     
}

/*
 * loop until the server does not respond, then loop until it responds again
 * this is NOT WORKING as expected, stubbed out in LIcenseUsage
 */
FVT.verifyServerRestart = function( domain, callback, expectedConfig, done ) {
    FVT.trace( 1, 'VerifyServerRestart: '+ encodeURI(domain) );
    FVT.trace( 0, 'ClientTime: '+ new Date() );
    verifyThis = expectedConfig ;
    verifyMessage = expectedConfig ;
    FVT.trace( 1, 'Expected Config: '+ JSON.stringify(expectedConfig) );
var SAVE_DEBUG=FVT.DEBUG;
FVT.DEBUG=2;
var SERVER_STOPPED = false;
var SERVER_RETRY_MAX = 30;
var SERVER_RETRY_COUNT = 0;

    try {
        while ( SERVER_STOPPED != true ) {
            FVT.trace( 0, "Get Server status #." + SERVER_RETRY_COUNT );
            request(url)
              .get(  encodeURI(domain)  )
              .end(function(err, res) {
                FVT.trace( 0, 'get status');
                if (err) {
                    FVT.trace( 1, '=== ERROR in verifyServerRestart ===:'+ String(err) );
                    if ( err == "connect ECONNREFUSED" ) {
                        FVT.trace( 0, "Server has STOPPED, now wait for the RESTART" );
                        SERVER_STOPPED = true;
                    }
                } else {
                    FVT.trace( 0, "Server has not stopped yet" );
                    if ( SERVER_RETRY_COUNT == SERVER_RETRY_MAX ) {
                        SERVER_STOPPED = true ; // let chips fall - must have been quick and missed the restart...
                    } else {
                        FVT.sleep( 500 );
                    }
                    callback( err, res, done );
                }
            });
            if ( SERVER_RETRY_COUNT == SERVER_RETRY_MAX ) {
                SERVER_STOPPED = true ; // let chips fall - must have been quick and missed the restart...
            } else {
                FVT.sleep( 500 );
            }
            SERVER_RETRY_COUNT++;
        }
        SERVER_RETRY_COUNT = 0;
        while ( SERVER_STOPPED ) {
            FVT.trace( 0, "Get Server restart status #: " + SERVER_RETRY_COUNT );
            request(url)
              .get(  encodeURI(domain)  )
              .end(function(err, res) {
                if (err) {
                    FVT.trace( 1, '=== ERROR in verifyServerRestart ===:'+ String(err) );
                    if ( err == "connect ECONNREFUSED" ) {
                        FVT.trace( 0, "Server is Stopped, waiting for the RESTART to complete" );
                        FVT.sleep( 500 );
                    } 
                } else {
                    SERVER_STOPPED = false;
                        
                    var expectedStatus = verifyThis.status ;
                    if ( typeof expectedStatus === 'undefined' ) { expectedStatus = 200 };
                    FVT.trace( 2, 'The expectedStatus: '+ expectedStatus );
                        
                    if ( typeof res !== 'undefined' ) {
                        FVT.trace( 2, 'Actual RESPONSE obj: '+ JSON.stringify( res, 1,1 ) );
                        var responseStatus = JSON.parse(res.statusCode);
                        FVT.trace( 2, 'Actual responseStatus: '+ responseStatus );

                        if ( expectedStatus == responseStatus ) {
                            FVT.trace( 1, 'The '+ responseStatus +' response was expected.' );
                            callback( null, res, done );
                        } else {
                            FVT.trace( 0, 'Unexpected Exception/Response in verifyServerRestart: ['+ err +'] Expected: '+ JSON.stringify( verifyThis ) );
                            FVT.trace( 0, JSON.stringify(res, null, 2));
                            verifyMessage = '' ; verifyThis = '' ;
                            throw new Error(err);
                        }
                        
                    } else { // no 'res' object returned
                        verifyMessage = '' ; verifyThis = '' ;
                        throw new Error(err);
                    }

//                        FVT.trace( 0, "Server appears to have restarted, check response." );
                       callback( err, res, done );
                }
            });
            if ( SERVER_RETRY_COUNT == SERVER_RETRY_MAX ) {
                SERVER_STOPPED = false ; // let chips fall - must have been quick and missed the restart...
            } else {
                FVT.sleep( 500 );
            }
            SERVER_RETRY_COUNT++;
            
        }
        
        
        verifyMessage = '' ; verifyThis = '' ;
        
    } catch ( ex ) {
        verifyMessage = '' ; verifyThis = '' ;
        FVT.trace( 0, "Unexpected Exception in verifyServerRestart: "+ ex.message );
        FVT.trace( 0, JSON.stringify(ex.message, null, 2));
    }
    
    FVT.DEBUG=SAVE_DEBUG;
};


/*
 * Make a GET request (either one)
 * Value of 'expectedConfig' depends on the 'callback' selected.
 * getSuccessCallback - JSON element of what you want to look for in the response
 * or getVerifyDeleteCallback or verify404NotFound, getFailureCallback, then expectedConfig 
 * is JSON Object of what you DON'T want to see, with the "status":40x RC expected
 * 'domain' is ALWAYS encoded, if you don't want that use FVT.makeGetRequestNoEncode().
 */
FVT.makeGetRequest = function( domain, callback, expectedConfig, done ) {
    FVT.trace( 1, 'Get Object: '+ encodeURI(domain) );
    FVT.trace( 0, 'ClientTime: '+ new Date() );
    verifyThis = expectedConfig ;
    verifyMessage = expectedConfig ;
    if ( JSON.stringify(expectedConfig) === undefined ) {
        // assume NOT JSON, like Plugin/../PropertiesFile response
        FVT.trace( 1, 'Expected Config: '+ expectedConfig );
    } else {
        FVT.trace( 1, 'Expected Config: '+ JSON.stringify(expectedConfig) );
    }
var SAVE_DEBUG=FVT.DEBUG;
FVT.DEBUG=2;

    try {
        request(url)
          .get(  encodeURI(domain)  )
          .end(function(err, res) {
            if (err) {
                FVT.trace( 1, '=== ERROR in makeGetRequest ===:'+ String(err) );
                if ( err == "connect ECONNREFUSED" ) {
                    FVT.trace( 0, "Unexpected RESTAPI connection failure, Need to call FVT.sleep( millisec) and retry" );
                }
                if ( err == "SyntaxError: Unexpected end of input" ) {
                    FVT.trace( 0, "Unexpected INPUT Error, the RESTAPI returned this response: "+ JSON.stringify( res ) );
                }
//     133793        
//                var msg = "SyntaxError:  Unexpected token" ;
//                if ( err.substring(0, msg.length) === msg ) {
//                    FVT.trace( 0, "Unexpected RESPONSE Error, the RESTAPI returned this response: "+ JSON.stringify( res ) );
//                }
                
                var expectedStatus = verifyThis.status ;
                if ( typeof expectedStatus === 'undefined' ) { expectedStatus = 200 };
                FVT.trace( 2, 'The expectedStatus: '+ expectedStatus );
                
                if ( typeof res !== 'undefined' ) {
                    FVT.trace( 2, 'Actual RESPONSE obj: '+ JSON.stringify( res, 1,1 ) );
                    var responseStatus = JSON.parse(res.statusCode);
                    FVT.trace( 2, 'Actual responseStatus: '+ responseStatus );

                    if ( expectedStatus == responseStatus ) {
                        FVT.trace( 1, 'The '+ responseStatus +' response was expected.' );
//                        if ( expectedStatus ==  404 ) {
//                            callback( err, res, done );
//                        } else {
                            callback( null, res, done );
//                        }
                    } else {
    //                    FVT.trace( 0, 'Unexpected Exception/Response in makeGetRequest: ['+ err +'] Expected: '+ JSON.parse( verifyThis ) );
                        FVT.trace( 0, 'Unexpected Exception/Response in makeGetRequest: ['+ err +'] Expected: '+ JSON.stringify( verifyThis ) );
                        FVT.trace( 0, JSON.stringify(res, null, 2));
    //                    if ( MOCHA_STOP_FIRST_ERROR === true ) {
    //                        debugger;
    //                    } else {
                            verifyMessage = '' ; verifyThis = '' ;
                            throw new Error(err);
    //                    }
                    }
                } else { // no 'res' object returned
                    verifyMessage = '' ; verifyThis = '' ;
                    throw new Error(err);
                }

            } else {

                callback( err, res, done );
            }
            verifyMessage = '' ; verifyThis = '' ;
        });
    } catch ( ex ) {
        verifyMessage = '' ; verifyThis = '' ;
        FVT.trace( 0, "Unexpected Exception in makeGetRequest: "+ ex.message);
        FVT.trace( 0, JSON.stringify(ex.message, null, 2));
    }
    FVT.DEBUG=SAVE_DEBUG;
};


FVT.makeGetRequestWithAuth = function( thisURL, domain, auth, callback, expectedConfig, done ) {
    if ( thisURL === null ){ thisURL = url ; }
    var splitAuth = auth.toString().split( "," );
    FVT.trace( 1, 'Get Object: '+ thisURL + encodeURI(domain) + " AUTH " + splitAuth[0] +" : "+ splitAuth[1]  );
    FVT.trace( 0, 'ClientTime: '+ new Date() );
    verifyThis = expectedConfig ;
    verifyMessage = expectedConfig ;
    if ( JSON.stringify(expectedConfig) === undefined ) {
        // assume NOT JSON, like Plugin/../PropertiesFile response
        FVT.trace( 1, 'Expected Config: '+ expectedConfig );
    } else {
        FVT.trace( 1, 'Expected Config: '+ JSON.stringify(expectedConfig) );
    }
var SAVE_DEBUG=FVT.DEBUG;
FVT.DEBUG=2;

    try {
        request(thisURL)
          .get(  encodeURI(domain)  )
          .auth(splitAuth[0] , splitAuth[1])
          .end(function(err, res) {
            if (err) {
                FVT.trace( 1, '=== ERROR in makeGetRequestWithAuth ===:'+ String(err) );
                if ( err == "connect ECONNREFUSED" ) {
                    FVT.trace( 0, "Unexpected RESTAPI connection failure, Need to call FVT.sleep( millisec) and retry" );
                }
                if ( err == "SyntaxError: Unexpected end of input" ) {
                    FVT.trace( 0, "Unexpected INPUT Error, the RESTAPI returned this response: "+ JSON.stringify( res ) );
                }
//     133793        
//                var msg = "SyntaxError:  Unexpected token" ;
//                if ( err.substring(0, msg.length) === msg ) {
//                    FVT.trace( 0, "Unexpected RESPONSE Error, the RESTAPI returned this response: "+ JSON.stringify( res ) );
//                }
                
                var expectedStatus = verifyThis.status ;
                if ( typeof expectedStatus === 'undefined' ) { expectedStatus = 200 };
                FVT.trace( 2, 'The expectedStatus: '+ expectedStatus );
                
                if ( typeof res !== 'undefined' ) {
                    FVT.trace( 2, 'Actual RESPONSE obj: '+ JSON.stringify( res, 1,1 ) );
                    var responseStatus = JSON.parse(res.statusCode);
                    FVT.trace( 2, 'Actual responseStatus: '+ responseStatus );

                    if ( expectedStatus == responseStatus ) {
                        FVT.trace( 1, 'The '+ responseStatus +' response was expected.' );
//                        if ( expectedStatus ==  404 ) {
//                            callback( err, res, done );
//                        } else {
                            callback( null, res, done );
//                        }
                    } else {
    //                    FVT.trace( 0, 'Unexpected Exception/Response in makeGetRequest: ['+ err +'] Expected: '+ JSON.parse( verifyThis ) );
                        FVT.trace( 0, 'Unexpected Exception/Response in makeGetRequesWithAutht: ['+ err +'] Expected: '+ JSON.stringify( verifyThis ) );
                        FVT.trace( 0, JSON.stringify(res, null, 2));
    //                    if ( MOCHA_STOP_FIRST_ERROR === true ) {
    //                        debugger;
    //                    } else {
                            verifyMessage = '' ; verifyThis = '' ;
                            throw new Error(err);
    //                    }
                    }
                } else { // no 'res' object returned
                    verifyMessage = '' ; verifyThis = '' ;
                    throw new Error(err);
                }

            } else {

                callback( err, res, done );
            }
            verifyMessage = '' ; verifyThis = '' ;
        });
    } catch ( ex ) {
        verifyMessage = '' ; verifyThis = '' ;
        FVT.trace( 0, "Unexpected Exception in makeGetRequestWithAuth: "+ ex.message);
        FVT.trace( 0, JSON.stringify(ex.message, null, 2));
    }
    FVT.DEBUG=SAVE_DEBUG;
};

/*
 * Make a GET request (either one)
 * Value of 'expectedConfig' depends on the 'callback' selected.
 * getSuccessCallback - JSON element of what you want to look for in the response
 * or getVerifyDeleteCallback or verify404NotFound, getFailureCallback, then expectedConfig 
 * is JSON Object of what you DON'T want to see, with the "status":40x RC expected
 * 'domain' is NEVER encoded, if you don't want that use FVT.makeGetRequest().
 */
FVT.makeGetRequestNoEncode = function( domain, callback, expectedConfig, done ) {
    FVT.trace( 1, 'Get Object: '+ domain );
    FVT.trace( 0, 'ClientTime: '+ new Date() );
    verifyThis = expectedConfig ;
    verifyMessage = expectedConfig ;
    FVT.trace( 1, 'Expected Config: '+ JSON.stringify(expectedConfig) );
var SAVE_DEBUG=FVT.DEBUG;
FVT.DEBUG=2;

    try {
        request(url)
          .get(  domain  )
          .end(function(err, res) {
            if (err) {
                FVT.trace( 1, '=== ERROR in makeGetRequestNoEncode ===:'+ String(err) );
                if ( err == "connect ECONNREFUSED" ) {
                    FVT.trace( 0, "Unexpected RESTAPI connection failure, Need to call FVT.sleep( millisec) and retry" );
                }
                
                var expectedStatus = verifyThis.status;
                if ( typeof verifyThis.status === 'undefined' ) { expectedStatus = 200; }
                FVT.trace( 2, 'The expectedStatus: '+ expectedStatus );
                
                if ( typeof res !== 'undefined' ) {
                    FVT.trace( 2, 'Actual RESPONSE obj: '+ JSON.stringify( res, 1,1 ) );
                    var responseStatus = JSON.parse(res.statusCode);
                    FVT.trace( 2, 'Actual responseStatus: '+ responseStatus );

                    if ( expectedStatus == responseStatus ) {
                        FVT.trace( 1, 'The '+ responseStatus +' response was expected.' );
                        if ( expectedStatus ==  404 ) {
                            callback( err, res, done );
                        } else {
                            callback( null, res, done );
                        }
                    } else {
    //                    FVT.trace( 0, 'Unexpected Exception/Response in makeGetRequest: ['+ err +'] Expected: '+ JSON.parse( verifyThis ) );
                        FVT.trace( 0, 'Unexpected Exception/Response in makeGetRequest: ['+ err +'] Expected: '+ JSON.stringify( verifyThis ) );
                        FVT.trace( 0, JSON.stringify(res, null, 2));
    //                    if ( MOCHA_STOP_FIRST_ERROR === true ) {
    //                        debugger;
    //                    } else {
                            verifyMessage = '' ; verifyThis = '' ;
                            throw new Error(err);
    //                    }
                    }
                } else { // no 'res' object returned
                    verifyMessage = '' ; verifyThis = '' ;
                    throw new Error(err);
                }
//                callback( err, res, done );
            } else {
                callback( err, res, done );
            }
            verifyMessage = '' ; verifyThis = '' ;
        });
    } catch ( ex ) {
        verifyMessage = '' ; verifyThis = '' ;
        FVT.trace( 0, "Unexpected Exception in makeGetRequest: "+ ex.message);
        FVT.trace( 0, JSON.stringify(ex.message, null, 2));
    }
    FVT.DEBUG=SAVE_DEBUG;
};

// for adminEndpoint Port changes
FVT.makeGetRequestWithURL = function( thisURL, domain, callback, expectedConfig, done ) {
    FVT.trace( 1, 'Get Object: '+ thisURL + encodeURI(domain) );
    FVT.trace( 0, 'ClientTime: '+ new Date() );
    verifyThis = expectedConfig ;
    verifyMessage = expectedConfig ;
    FVT.trace( 1, 'Expected Config: '+ JSON.stringify(expectedConfig) );
var SAVE_DEBUG=FVT.DEBUG;
FVT.DEBUG=2;

    try {
        request(thisURL)
          .get(  encodeURI(domain)  )
          .end(function(err, res) {
            if (err) {
                FVT.trace( 1, '=== ERROR in makeGetRequestWithURL ===:'+ String(err) );
                var expectedStatus = verifyThis.status ;
                FVT.trace( 2, 'The expectedStatus: (if not 200)'+ expectedStatus );
                if ( res ) {
                    var responseStatus = JSON.parse(res.statusCode);
                    FVT.trace( 2, 'Actual responseStatus: '+ responseStatus );

                    if ( expectedStatus == responseStatus ) {
                        FVT.trace( 1, 'The '+ responseStatus +' response was expected.' );
                        callback( null, res, done );
                    } else {
                        FVT.trace( 0, 'Unexpected Exception/Response in makeGetRequest: ['+ err +'] Expected: '+ JSON.parse( verifyThis ) );
                        FVT.trace( 0, JSON.stringify(res, null, 2));
//                        if ( MOCHA_STOP_FIRST_ERROR === true ) {
//                            debugger;
//                         } else {
                            verifyMessage = '' ; verifyThis = '' ;
                            throw new Error(err);
//                        }
                    }
//                callback( err, res, done );
                } else {
                    FVT.trace( 1, 'There was no RESPONSE Object with this error.' );
                }
            } else {
                callback( err, res, done );
            }
            verifyMessage = '' ; verifyThis = '' ;
        });
    } catch ( ex ) {
        verifyMessage = '' ; verifyThis = '' ;
        FVT.trace( 0, "Unexpected Exception in makeGetRequestWithURL: "+ ex.message);
        FVT.trace( 0, JSON.stringify(ex.message, null, 2));
    }
    FVT.DEBUG=SAVE_DEBUG;
};


/*
 * Make a GET Monitor request
 */
FVT.makeGetRequestWithQuery = function(thisURL, domain, params, callback, expectedConfig, done) {
//    FVT.trace( 2, 'Get Object: '+ encodeURI(domain) + ' with Query: ' + qs.parse(params) )
    FVT.trace( 2, 'Get Object: '+ encodeURI(domain) + ' with Query: ' + params )
    FVT.trace( 0, 'ClientTime: '+ new Date() );
    verifyThis = expectedConfig ;
    verifyMessage = expectedConfig ;
    FVT.trace( 1, 'Expected Config: '+ JSON.stringify(expectedConfig) );
var SAVE_DEBUG=FVT.DEBUG;
FVT.DEBUG=2;

    try {
        if ( thisURL === null ){ thisURL = url ; }
        request(thisURL)
//          .get( encodeURI(domain) , qs.parse(params) )               // Error: ignored, only get 25 rows should get 50
//          .get( encodeURI(domain) , qs.parse(params) )               // Error: ignored, only get 25 rows should get 50
//          .get( encodeURI(domain) + '?' + params )                   // Error:  SyntaxError: Unexpected token B (small MQTT Pass)
//          .get( encodeURI(domain) + '?' + encodeURI(params) )        // Error:  SyntaxError: Unexpected token B (small MQTT Pass)
//          .get( encodeURI(domain) + '?' + qs.parse(params) )         // Error: ignored, only get 25 rows should get 50
// or
          .get( encodeURI(domain) )                        // GET with .query()
          .query( params )                                           // Error:  SyntaxError: Unexpected token B (small MQTT Pass)
//          .query( encodeURI(params) )                                // Error:  SyntaxError: Unexpected token B (small MQTT Pass)
//          .query( qs.parse(params) )                                 // Error:  SyntaxError: Unexpected token B (small MQTT Pass)
// RE:  http://visionmedia.github.io/superagent/#get-requests
//          .query( 'ResultCount=100&SubName=/OrgMove*' )              // Error:  SyntaxError: Unexpected token B (small MQTT Pass)
//          .query( {ResultCount:'100', SubName:"/OrgMove*"} )           // Error:  SyntaxError: Unexpected token B (small MQTT Pass)
          .end( function(err, res) {
            if (err) {
                FVT.trace( 1, '=== ERROR in makeGetRequestWithQuery ===:'+ String(err) );
                var expectedStatus = verifyThis.status ;
                FVT.trace( 2, 'The expectedStatus: (if not 200)'+ expectedStatus );
                if ( res ) {
                    var responseStatus = JSON.parse(res.statusCode);
                    FVT.trace( 2, 'Actual responseStatus: '+ responseStatus );

                    if ( expectedStatus == responseStatus ) {
                        FVT.trace( 1, 'The '+ responseStatus +' response was expected.' );
                        callback( null, res, done );
                    } else {
                        FVT.trace( 0, 'Unexpected Exception/Response in makeGetRequest: ['+ err +'] Expected: '+ JSON.parse( verifyThis ) );
                        FVT.trace( 0, JSON.stringify(res, null, 2));
//                        if ( MOCHA_STOP_FIRST_ERROR === true ) {
//                            debugger;
//                         } else {
                            verifyMessage = '' ; verifyThis = '' ;
                            throw new Error(err);
//                        }
                    }
//                callback( err, res, done );
                } else {
                    FVT.trace( 1, 'There was no RESPONSE Object with this error.' );
                }
            } else {
                callback( err, res, done );
            }
            verifyMessage = '' ; verifyThis = '' ;
        });
    } catch ( ex ) {
        verifyMessage = '' ; verifyThis = '' ;
        FVT.trace( 0, "Unexpected Exception in makeGetRequestWithQuery: "+ ex.message);
        FVT.trace( 0, JSON.stringify(ex.message, null, 2));
    }
    FVT.DEBUG=SAVE_DEBUG;
};


/*
 * Make a DELETE request
 * DOMAIN is ALWAYS encoded, if not desired use FVT.makeDeleteRequestNoEncode() 
 */
FVT.makeDeleteRequest = function( domain, callback, expectedConfig, expectedMessage, done ) {
    FVT.trace( 1, 'Delete Object: '+ encodeURI(domain) );
    FVT.trace( 0, 'ClientTime: '+ new Date() );
    verifyThis = expectedConfig;
    verifyMessage = expectedMessage;
    try {
        request( url )
        .delete(  encodeURI(domain)  )
        .end(function(err, res) {
            if (err) {
                FVT.trace( 0, '=== ERROR in makeDeleteRequest ===:' + String(err) );
                FVT.trace( 1, "ExpectedMessage.status (if not 400) = "+ expectedMessage.status );
                if ( res ) {
                    FVT.trace( 2, "Delete Response:  "+ JSON.stringify(res, null, 2) );
                    if  (expectedMessage.status) {
                        res.statusCode.should.equal( expectedMessage.status )
                        delete expectedMessage.status;  // remove for 'verifyResponseTextParameter' processing
                    } else {
                        res.statusCode.should.equal(400);
    //                    throw err;
                    }
                    var jsonResponse = JSON.parse( res.text );
                    verifyResponseTextParameter( jsonResponse); 
                    verifyMessage = '' ; verifyThis = '' ;
                    done();  // don't need to call the callback, this is processed...
                } else {
                    FVT.trace(0, "There was no RESPONSE Object with this error." );
                }
            } else {
                callback( null, res, done);
            }
             verifyMessage = '' ; verifyThis = '' ;
       });
    } catch ( ex ) {
        verifyMessage = '' ; verifyThis = '' ;
        FVT.trace( 0, "Unexpected Exception in makeDeleteRequest: "+ ex.message);
        FVT.trace( 0, JSON.stringify(ex.message, null, 2));
    }
};

/*
 * Make a DELETE request with URL Specified
 * DOMAIN is ALWAYS encoded, if not desired use FVT.makeDeleteRequestNoEncode() 
 */
FVT.makeDeleteRequestWithURL = function( thisURL, domain, callback, expectedConfig, expectedMessage, done ) {
    FVT.trace( 1, 'Delete Object: '+ encodeURI(domain) );
    FVT.trace( 0, 'ClientTime: '+ new Date() );
    verifyThis = expectedConfig;
    verifyMessage = expectedMessage;
    FVT.trace( 1, 'Expect Response Message:  '+ verifyMessage.Message +' from '+ JSON.stringify(expectedMessage) );
    try {
        request( thisURL )
        .delete(  encodeURI(domain)  )
        .end(function(err, res) {
            if (err) {
                FVT.trace( 0, '=== ERROR in makeDeleteRequestWithURL ===:' + String(err) );
                FVT.trace( 1, "ExpectedMessage.status (if not 400) = "+ expectedMessage.status );
                if ( res ) {
                    FVT.trace( 2, "Delete Response:  "+ JSON.stringify(res, null, 2) );
                    if  (expectedMessage.status) {
                        res.statusCode.should.equal( expectedMessage.status )
                        delete expectedMessage.status;  // remove for 'verifyResponseTextParameter' processing
                    } else {
                        res.statusCode.should.equal(400);
    //                    throw err;
                    }
                    var jsonResponse = JSON.parse( res.text );
                    verifyResponseTextParameter( jsonResponse);    
                    verifyMessage = '' ; verifyThis = '' ;
                    done();  // don't need to call the callback, this is processed...
                } else {
                    FVT.trace(0, "There was no RESPONSE Object with this error.");
                }
            } else {
                callback( null, res, done);
            }
            verifyMessage = '' ; verifyThis = '' ;
        });
    } catch ( ex ) {
        verifyMessage = '' ; verifyThis = '' ;
        FVT.trace( 0, "Unexpected Exception in makeDeleteRequestWithURL: "+ ex.message);
        FVT.trace( 0, JSON.stringify(ex.message, null, 2));
    }
};


/*
 * Make a DELETE request with URL Specified
 * DOMAIN is ALWAYS encoded, if not desired use FVT.makeDeleteRequestNoEncode() 
 */
FVT.makeDeleteRequestWithAuth = function( thisURL, domain, auth, callback, expectedConfig, expectedMessage, done ) {
    if ( thisURL === null ){ thisURL = url ; }
    var splitAuth = auth.split( "," );
    FVT.trace( 1, 'Delete Object: '+ thisURL +  encodeURI(domain) + " AUTH " + splitAuth[0] +" : "+ splitAuth[1] );
    FVT.trace( 0, 'ClientTime: '+ new Date() );
    verifyThis = expectedConfig;
    verifyMessage = expectedMessage;
    FVT.trace( 1, 'Expect Response Message:  '+ verifyMessage.Message +' from '+ JSON.stringify(expectedMessage) );
    try {
        request( thisURL )
        .delete(  encodeURI(domain)  )
        .auth( splitAuth[0] , splitAuth[1] )
        .end(function(err, res) {
            if (err) {
                FVT.trace( 0, '=== ERROR in makeDeleteRequestWithURL ===:' + String(err) );
                FVT.trace( 1, "ExpectedMessage.status (if not 400) = "+ expectedMessage.status );
                if ( res ) {
                    FVT.trace( 2, "Delete Response:  "+ JSON.stringify(res, null, 2) );
                    if  (expectedMessage.status) {
                        res.statusCode.should.equal( expectedMessage.status )
                        delete expectedMessage.status;  // remove for 'verifyResponseTextParameter' processing
                    } else {
                        res.statusCode.should.equal(400);
    //                    throw err;
                    }
                    var jsonResponse = JSON.parse( res.text );
                    verifyResponseTextParameter( jsonResponse);    
                    verifyMessage = '' ; //verifyThis = '' ;
                    done();  // don't need to call the callback, this is processed...  BRIDGE PROSSBILE INCOMPATIBILITY, comment out vlear of verifyThis
                } else {
                    FVT.trace(0, "There was no RESPONSE Object with this error.");
                }
            } else {
                callback( null, res, done);
            }
            verifyMessage = '' ; verifyThis = '' ;
        });
    } catch ( ex ) {
        verifyMessage = '' ; verifyThis = '' ;
        FVT.trace( 0, "Unexpected Exception in makeDeleteRequestWithURL: "+ ex.message);
        FVT.trace( 0, JSON.stringify(ex.message, null, 2));
    }
};

/*
 * Make a DELETE request
 * DOMAIN is NEVER encoded, if not desired use FVT.makeDeleteRequest() 
 */
FVT.makeDeleteRequestNoEncode = function( domain, callback, expectedConfig, expectedMessage, done ) {
    FVT.trace( 1, 'Delete Object: '+ domain );
    FVT.trace( 0, 'ClientTime: '+ new Date() );
    verifyThis = expectedConfig;
    verifyMessage = expectedMessage;
    try {
        request( url )
        .delete(  domain  )
        .end(function(err, res) {
            if (err) {
                FVT.trace( 0, '=== ERROR in makeDeleteRequest ===:' + String(err) );
                FVT.trace( 1, "ExpectedMessage.status (if not 400) = "+ expectedMessage.status );
                if ( res ) {
                    FVT.trace( 2, "Delete Response:  "+ JSON.stringify(res, null, 2) );
                    if  (expectedMessage.status) {
                        res.statusCode.should.equal( expectedMessage.status )
                        delete expectedMessage.status;  // remove for 'verifyResponseTextParameter' processing
                    } else {
                        res.statusCode.should.equal(400);
    //                    throw err;
                    }
                    var jsonResponse = JSON.parse( res.text );
                    verifyResponseTextParameter( jsonResponse);    
                    verifyMessage = '' ; verifyThis = '' ;
                    done();  // don't need to call the callback, this is processed...
                } else {
                    FVT.trace(0, "There was no RESPONSE Object with this error.");
                }
            } else {
                callback(null, res, done);
            }
            verifyMessage = '' ; verifyThis = '' ;
        });
    } catch ( ex ) {
        verifyMessage = '' ; verifyThis = '' ;
        FVT.trace( 0, "Unexpected Exception in makeDeleteRequest: "+ ex.message);
        FVT.trace( 0, JSON.stringify(ex.message, null, 2));
    }
};


/*
 * Make a Put request
 */
FVT.makePutRequest = function( domain, file, callback, done ) {
    FVT.trace( 1, 'PUT DOMAIN: '+ url + encodeURI(domain) + '  with file: ' + file);
    FVT.trace( 0, 'ClientTime: '+ new Date() );
    verifyThis = '';
    verifyMessage = '';

    try {
        var payload = String(fs.readFileSync( file ));
        FVT.trace( 5, 'FILE PAYLOAD: '+ payload );

        request(url)
          .put(  encodeURI(domain)  )
          .send(payload)
          .end(function(err, res) {
            if (err) {
                FVT.trace( 0, 'PUT ERROR: '+ err +' response '+ JSON.stringify( res.text ) );
////                if ( MOCHA_STOP_FIRST_ERROR === true ) {
////                    debugger;
////                } else {
                    verifyMessage = '' ; verifyThis = '' ;
                    throw new Error(err);
////                }
                
            }
            callback(err, res, done);
        });
// -----
        } catch ( ex ) {
        FVT.trace( 0, "Unexpected Exception in makePutRequest: "+ ex.message);
        FVT.trace( 0, JSON.stringify(ex.message, null, 2));
        verifyMessage = '' ; verifyThis = '' ;
        //throw ex;
    }
};

FVT.makePutBinary = function( domain, sfile, tfile, callback, done ) {
    FVT.trace( 1, 'PutBinary DOMAIN: '+ url + encodeURI(domain) + '  with file: ' + file);
    FVT.trace( 0, 'ClientTime: '+ new Date() );
    verifyThis = '';
    verifyMessage = '';
    try {

        request.post(url + encodeURI(domain)  )
          .attach( tfile, sfile )
          .end(function(err, res) {
            if (err) {
                FVT.trace( 0, 'PUT ERROR: '+ err +' response '+ JSON.stringify( res.text ) );
////                if ( MOCHA_STOP_FIRST_ERROR === true ) {
////                    debugger;
////                } else {
                    verifyMessage = '' ; verifyThis = '' ;
                    throw new Error(err);
////                }
                
            }
            callback(err, res, done);
        });
// -----
        } catch ( ex ) {
        verifyMessage = '' ; verifyThis = '' ;
        FVT.trace( 0, "Unexpected Exception in makePutRequest: "+ ex.message);
        FVT.trace( 0, JSON.stringify(ex.message, null, 2));
        //throw ex;
    }
};
// Subscriber Callback
FVT.subCallback = function( err, granted ){
    if ( err != null ) {
        console.log( "==  subCallBack with ERR:  "+ String(err) );
    } else if ( granted != null ) {
        console.log( "==  subCallBack with ACTION:  "+ JSON.stringify(granted) );
    } else {
        console.log( "==  subCallBack and everything was null?!" );
    }
};


describe('acceptLicense:', function() {
    this.timeout( FVT.defaultTimeout );
/*  Handled in automation now
    it('should return 200 and restart"', function(done) {
        var payload = '{"Accept":true}';
        var verifyPayload = JSON.parse( payload ) ;
        verifyMessage = {"status":200,"Code":"CWLNA6011","Message":"The requested configuration change has completed successfully.","text":null} ;
        FVT.makePostRequest( FVT.uriConfigDomain, payload, FVT.postSuccessCallback, verifyPayload, done);
    });
*/
/* It really did not help the 0818/2016 results, there is still a gap after TraceLevel until Reset:config server restart
    it('should return 200 on trace/flush TEMP FIX for 151954/151772"', function(done) {
        var payload = {};
        var verifyConfig = {} ;
        verifyMessage = {"status":200,"Code":"CWLNA6011","Message":"The requested configuration change has completed successfully." } ;
        FVT.makePostRequest( FVT.uriServiceDomain + "trace/flush", payload, FVT.postSuccessCallback, verifyMessage, done);
    });
*/
    it('should return status 200 on GET "Status" after License Accept', function(done) {
        if ( FVT.TestEnv == "HA" ) {
            this.timeout( FVT.START_HA + 3000 );
            FVT.sleep( FVT.START_HA );
        } else if ( FVT.TestEnv == "CLUSTER" ) {
            this.timeout( FVT.START_CLUSTER + 3000 );
            FVT.sleep( FVT.START_CLUSTER );
        } else {
            this.timeout( FVT.REBOOT + 5000 ) ; 
            FVT.sleep( FVT.REBOOT ) ;
        }
        var verifyStatus = JSON.parse( '{"Server": {"ErrorCode": 0,"ErrorMessage": "","State": 1,"StateDescription": "Running (production)", "Status":"Running"}}' ) ;
        FVT.makeGetRequest( FVT.uriServiceDomain+'status', FVT.getSuccessCallback, verifyStatus, done)

    });
});


module.exports = FVT;
